下面是我在macOS Catalina 10.15编译FFmpeg 3.4.1时出现的问题,记录下来备忘。
如果不需要编译特别的版本的话,编译新版FFmpeg可能不会遇到,如下面1和2,新版FFmpeg已Fix。
1、libavcodec/libfdk-aacenc.c:289:35: error: no member named 'encoderDelay' in 'AACENC_InfoStruct'
avctx->initial_padding = info.encoderDelay;
解决方法:
根据下面链接fix committed
https://github.com/libav/libav/commit/141c960e21d2860e354f9b90df136184dd00a9a8
2、编译过程出现如下错误(use of undeclared identifier 'x264_bit_depth'):
libavcodec/libx264.c:271:9: error: use of undeclared identifier 'x264_bit_depth'
if (x264_bit_depth > 8)
^
libavcodec/libx264.c:898:9: error: use of undeclared identifier 'x264_bit_depth'
if (x264_bit_depth == 8)
^
libavcodec/libx264.c:900:14: error: use of undeclared identifier 'x264_bit_depth'
else if (x264_bit_depth == 9)
^
libavcodec/libx264.c:902:14: error: use of undeclared identifier 'x264_bit_depth'
else if (x264_bit_depth == 10)
解决方法:
打开libx264.c,找到相应的代码行,将“x264_bit_depth”改成“X264_BIT_DEPTH”即可
http://git.videolan.org/?p=ffmpeg.git;a=commitdiff;h=2a111c99a60fdf4fe5eea2b073901630190c6c93
static av_cold void X264_init_static(AVCodec *codec)
{
- if (x264_bit_depth == 8)
+ if (X264_BIT_DEPTH == 8)
codec->pix_fmts = pix_fmts_8bit;
- else if (x264_bit_depth == 9)
+ else if (X264_BIT_DEPTH == 9)
codec->pix_fmts = pix_fmts_9bit;
- else if (x264_bit_depth == 10)
+ else if (X264_BIT_DEPTH == 10)
codec->pix_fmts = pix_fmts_10bit;
+ else /* X264_BIT_DEPTH == 0 */
+ codec->pix_fmts = pix_fmts;
}
3、编译好后,在终端执行 ffplay、ffmepg时报 Segmentation fault: 11。这个问题貌似在macOS 10.15 Catalina才会出现。
$ ffmpeg
Segmentation fault: 11
解决方法:
在编译执行./configure时,添加 --extra-cflags =“-fno-stack-check”,然后make distclean重新编译
./configure --prefix=/usr/local --extra-cflags="-fno-stack-check" --enable-ffplay --enable-gpl --enable-nonfree --enable-libass --enable-libfdk-aac --enable-libfreetype --enable-libmp3lame --enable-libtheora --enable-libvorbis --enable-libvpx --enable-libx264 --enable-libopus --enable-libxvid --samples=fate-suite