macOS 10.15.7 编译FFmpeg
configure
./configure --enable-gpl --enable-version3 --enable-sdl2 --enable-fontconfig --enable-gnutls --enable-iconv --enable-libass --enable-libbluray --enable-libfreetype --enable-libmp3lame --enable-libopencore-amrnb --enable-libopencore-amrwb --enable-libopenjpeg --enable-libopus --enable-libshine --enable-libsnappy --enable-libsoxr --enable-libtheora --enable-libtwolame --enable-libvpx --enable-libwebp --enable-libx264 --enable-libx265 --enable-libxml2 --enable-libzimg --enable-lzma --enable-zlib --enable-gmp --enable-libvidstab --enable-libvorbis --enable-libvo-amrwbenc --enable-libmysofa --enable-libspeex --enable-libxvid --enable-libaom --enable-appkit --enable-avfoundation --enable-coreimage --enable-audiotoolbox
Unknown option “–enable-libwavpack”.
See ./configure --help for available options.
删除此选项
nasm/yasm not found or too old. Use --disable-x86asm for a crippled build.
yasm是汇编编译器,ffmpeg为了提高效率使用了汇编指令,如MMX和SSE等。所以系统中未安装yasm时,就会报上面错误。
解决错误:安装yasm编译器。安装方法如下:
1)下载:yasm的下载链接
2)解压:把下载下来的压缩包进行解压
3)切换路径: cd yasm-1.3.0
4)执行配置: ./configure
5)编译:make
6)安装:make install(提示:Permission denied,就执行sudo make install)
ERROR: gmp not found
下载:
$ xz -d gmp-6.2.0.tar.xz $ tar -xvf gmp-6.2.0.tar
cd gmp-6.2.0
$ ./configure --enable-cxx
$ make -j4 # 4 核心编译速度更快 也可以直接 make
$ make check
$ sudo make install
解压gmp-6.2.0.tar.xz
zsh: command not found: xz
下载安装xz
https://sourceforge.net/projects/lzmautils/files/xz-5.2.5.tar.bz2/download
./configure
make
sudo make install
ERROR: gnutls not found using pkg-config
下载安装GnuTLS
https://www.gnutls.org/download.html
Required libraries:
- libnettle crypto back-end
- gmplib arithmetic library
下载Libgcrypt
https://www.lysator.liu.se/~nisse/nettle/
Libnettle 3.4.1 was not found.
下面一些是摸索和网上找的可能有用的方法:
(1)下载3.4.1,下载最新的3.6.15可能没用
(2)nettle这货安装的时候,自己安装到了/usr/local/lib目录下了。gnutls安装时默认会到系统目录下/usr/lib下寻找依赖关系。
软件路径瞎按,系统依赖瞎找是问题的形成原因。
安装nettle结束后,没有跟我们说安装到哪里了,我们看下nettle的路径
find /usr -name ‘nettle’
这个not found问题困扰了一整天,中文的文章都说是PKG_CONFIG_PATH 怎么拼,但无论我怎么拼都没用,最后在Stack Overflow上找到一篇,其中的一条评论给了正确方法
https://stackoverflow.com/questions/57730266/configure-gnutls-libnettle-3-4-1-was-not-found-os-x-lion
same issue for macOS 10.14.6: Libnettle 3.4.1 was not found. pkgconfig.freedesktop.org/releases can help.
我以为系统未安装pkgconfig工具,于是先下载源码安装碰到问题,再用brew安装发现系统已有,但不管怎样用brew重新安装了pkgconfig0.29.2,最关键的一步是
export PKG_CONFIG= /usr/local/Cellar/pkg-config/0.29.2/bin/pkg-config
重新./configure 就不报错了。
make: Nothing to be done for `all’
无解
使用brew install gnutls 安装,源码安装就不适合
ERROR: aom >= 1.0.0 not found using pkg-config
缺啥补啥,不多想了
brew install aom
ERROR: libass not found using pkg-config
ERROR: libmysofa not found
Cmake源码安装
git clone https://github.com/hoene/libmysofa.git
brew install cmake
cmake -DCMAKE_INSTALL_PREFIX=/usr/local -DBUILD_SHARED_LIBS=OFF -DBUILD_TESTS=OFF
make install
ERROR: libopencore_amrnb not found
brew install opencore-amr
ERROR: libopenjp2 >= 2.1.0 not found using pkg-config
brew install openjpeg
ERROR: opus not found using pkg-config
brew install opus
ERROR: shine not found using pkg-config
git clone https://github.com/toots/shine.git
cd shine
./bootstrap
报错: ./bootstrap: line 4: autoreconf: command not found
解决方法: brew install autoconf
依然报错:
Can’t exec “aclocal”: No such file or directory at /usr/local/Cellar/autoconf/2.69/share/autoconf/Autom4te/FileUtils.pm line 326.
解决方法:
brew install automake
./configure --prefix=/usr/local --disable-shared
make && make install
ERROR: libsnappy not found
brew install snappy
ERROR: libsoxr not found
brew install libsoxr
ERROR: speex not found using pkg-config
brew install speex
ERROR: libtheora not found
brew install theora
ERROR: libtwolame not found
brew install twolame
ERROR: vidstab >= 0.98 not found using pkg-config
brew install libvidstab
ERROR: libvo_amrwbenc not found
https://sourceforge.net/projects/opencore-amr/files/vo-amrwbenc/vo-amrwbenc-0.1.3.tar.gz/download
curl -O https://iweb.dl.sourceforge.net/project/opencore-amr/vo-amrwbenc/vo-amrwbenc-0.1.3.tar.gz
tar -zxvf ./vo-amrwbenc-0.1.3.tar.gz
cd ./vo-amrwbenc-0.1.3
./configure --prefix=/usr/local --disable-shared
make && make install
libvpx enabled but no supported decoders found
brew install libvpx
ERROR: libwebp >= 0.2.0 not found using pkg-config
brew install webp
ERROR: libx264 not found
brew install x264 x265
ERROR: libxvid not found
brew install xvid
ERROR: zimg >= 2.7.0 not found using pkg-config
brew install zimg
ERROR: sdl2 requested but not found
brew install sdl2
非常有帮助的一个博客
https://lvv.me/posts/2020/04/14_build_ffmpeg/
make && make install
$ ffmpeg -version
ffmpeg version N-99816-g3da35b7cc7 Copyright © 2000-2020 the FFmpeg developers
built with Apple clang version 12.0.0 (clang-1200.0.32.21)