iOS FFmpeg 在Mac OS下的编译和使用

时间:2021-03-17 01:23:20

在github上搜索build-ffmpeg.sh即可,编译一般情况没有问题,但是在使用的过程中容易出问题,报如下错误

Undefined symbols for architecture x86_64:

  "_AudioConverterDispose", referenced from:

      _ffat_close_decoder in libavcodec.a(audiotoolboxdec.o)

      _ffat_close_encoder in libavcodec.a(audiotoolboxenc.o)

  "_AudioConverterFillComplexBuffer", referenced from:

      _ffat_decode in libavcodec.a(audiotoolboxdec.o)

      _ffat_encode in libavcodec.a(audiotoolboxenc.o)

  "_AudioConverterGetProperty", referenced from:

      _ffat_create_decoder in libavcodec.a(audiotoolboxdec.o)

      _ffat_init_encoder in libavcodec.a(audiotoolboxenc.o)

  "_AudioConverterGetPropertyInfo", referenced from:

      _ffat_create_decoder in libavcodec.a(audiotoolboxdec.o)

      _ffat_init_encoder in libavcodec.a(audiotoolboxenc.o)

  "_AudioConverterNew", referenced from:

      _ffat_create_decoder in libavcodec.a(audiotoolboxdec.o)

      _ffat_init_encoder in libavcodec.a(audiotoolboxenc.o)

  "_AudioConverterReset", referenced from:

      _ffat_decode_flush in libavcodec.a(audiotoolboxdec.o)

      _ffat_encode_flush in libavcodec.a(audiotoolboxenc.o)

  "_AudioConverterSetProperty", referenced from:

      _ffat_create_decoder in libavcodec.a(audiotoolboxdec.o)

      _ffat_init_encoder in libavcodec.a(audiotoolboxenc.o)

  "_AudioFormatGetProperty", referenced from:

      _ffat_create_decoder in libavcodec.a(audiotoolboxdec.o)

  "_AudioFormatGetPropertyInfo", referenced from:

      _ffat_create_decoder in libavcodec.a(audiotoolboxdec.o)

ld: symbol(s) not found for architecture x86_64

clang: error: linker command failed with exit code 1 (use -v to see invocation)

这个错误是由于缺少系统动态库造成的,找出_ffat_create_decoder对应的库名,逐个添加即可

如:

FFmpeg: libavcodec/audiotoolboxdec.c File Reference

static int  ffat_set_extradata (AVCodecContext *avctx)   static av_cold int ffat_create_decoder (AVCodecContext *avctx, AVPacket *pkt)  ...

包含的文件是audiotool 找对应的库,马上可以解决问题