xcode - 从 QtApp 链接到 FFmpeg 时出现 libavcodec.a 链接器错误

标签 xcode qt ffmpeg linker-errors codec

我正在尝试链接我的 Qt 应用程序 FFmpeg .我使用 here 中的脚本从源代码构建 FFmpeg 作为静态库.并且,来自 here 的 x264 .

构建没问题。以下是我用于 FFmpeg 的配置标志:

CONFIGURE_FLAGS="--enable-cross-compile --enable-debug --disable-programs --enable-postproc \
              --enable-swscale --enable-avfilter --enable-avresample \
              --disable-doc --enable-pic --enable-static --disable-opencl --disable-shared --disable-securetransport \
              --enable-videotoolbox --enable-audiotoolbox --enable-gpl"

为 x264 配置标志:
CONFIGURE_FLAGS="--enable-static --enable-pic --disable-cli --disable-asm"

以下是我如何从我的 QtApp 链接库尝试为 MacOSX 构建它 :
LIBS+= -LPath/to/ffmpeg/build/lib -lavformat -lavcodec -lswscale -lavutil -lavfilter -lswresample \ 
-lavdevice -lpostproc -lx264 -lz -llzma -lbz2 -framework CoreVideo -framework CoreFoundation -framework CoreMedia \ 
-framework VideoToolbox -framework AudioToolbox -framework OpenAL -framework CoreServices -framework AVFoundation \ 
-framework QuartzCore -framework CoreGraphics

我包括FFmpeg标题也推荐:
#ifdef __cplusplus
extern "C"
{
  #include <libavcodec/avcodec.h>
  #include <libavformat/avformat.h>
  #include <libswscale/swscale.h>
  #include <libavutil/frame.h>
}
#endif

#if LIBAVCODEC_VERSION_INT < AV_VERSION_INT(55,28,1)
#define av_frame_alloc  avcodec_alloc_frame
#endif

问题:
但是当我调用 av_register_all .我收到以下链接器错误。
Undefined symbols for architecture x86_64:
"_VDADecoderCreate", referenced from:
  _ff_vda_create_decoder in libavcodec.a(vda_h264.o)
  _ff_vda_default_init in libavcodec.a(vda_h264.o)
"_VDADecoderDecode", referenced from:
  _vda_old_h264_end_frame in libavcodec.a(vda_h264.o)
  _vda_h264_end_frame in libavcodec.a(vda_h264.o)
"_VDADecoderDestroy", referenced from:
  _ff_vda_destroy_decoder in libavcodec.a(vda_h264.o)
"_VDADecoderFlush", referenced from:
  _vda_old_h264_end_frame in libavcodec.a(vda_h264.o)
  _vda_h264_end_frame in libavcodec.a(vda_h264.o)
"_kVDADecoderConfiguration_Height", referenced from:
  _ff_vda_create_decoder in libavcodec.a(vda_h264.o)
  _ff_vda_default_init in libavcodec.a(vda_h264.o)
"_kVDADecoderConfiguration_SourceFormat", referenced from:
  _ff_vda_create_decoder in libavcodec.a(vda_h264.o)
  _ff_vda_default_init in libavcodec.a(vda_h264.o)
"_kVDADecoderConfiguration_Width", referenced from:
  _ff_vda_create_decoder in libavcodec.a(vda_h264.o)
  _ff_vda_default_init in libavcodec.a(vda_h264.o)
"_kVDADecoderConfiguration_avcCData", referenced from:
  _ff_vda_create_decoder in libavcodec.a(vda_h264.o)
  _ff_vda_default_init in libavcodec.a(vda_h264.o)
ld: symbol(s) not found for architecture x86_64
clang: error: linker command failed with exit code 1 (use -v to see invocation)

问题:
我在这里想念什么?

最佳答案

固定 它。链接器列表中缺少以下内容

LIBS += -framework VideoDecodeAcceleration

这修复了与 libavcodec.a(vda_h264.o) 相关的所有链接器问题。
是的。

关于xcode - 从 QtApp 链接到 FFmpeg 时出现 libavcodec.a 链接器错误,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/46533265/

相关文章:

ios - fetchBatchSize 和 NSFetchedResultsController 中的缓存被忽略

c++ - QNetworkReply 在发出完成信号时抛出 SIGSEGV

java - ffmpeg 从图像创建视频需要很长时间

c++ - 选择 Qt 写入文本文件的自定义行结尾

c++ - Qt5.4.1升级到5.12.1,现在QCodec报异常

image-processing - ffmpeg 忽略每个帧率选项,将结果锁定为 25 fps

vb.net - 如何在 vb.net 中获取 ffmpeg 进程的参数?

ios - UITableViewCell "OnClick"iPad 方法

ios - Alpha 没有改变 UINavigationBar 的 barTintColor

c - 为什么在构建这个 C 项目时出现所有这些错误?