我想自己编译一个静态的ffmpeg二进制文件。我按照this guide,然后成功构建了一个。
./configure --extra-version=Chitanda_Eru --prefix=/Volumes/Chitanda_Eru/ --enable-gpl --enable-version3 --enable-nonfree --disable-shared --enable-static --enable-ffplay --disable-ffserver --enable-pthreads --enable-avisynth --enable-libvo-aacenc --enable-libfaac --enable-libfdk-aac --enable-libmp3lame --enable-libvorbis --enable-libx264 --enable-libx265 --enable-libxvid --enable-libbluray --enable-libtheora --enable-libcelt --enable-openssl --enable-libspeex --enable-postproc --enable-libvpx --enable-libgsm --enable-libopenjpeg --enable-libopus --enable-fontconfig --enable-libfreetype --enable-libass --enable-filters --disable-indev=qtkit --enable-runtime-cpudetect --enable-bzlib --enable-zlib --enable-libopencore-amrnb --enable-libopencore-amrwb --enable-libvo-amrwbenc --enable-libtwolame --enable-openal --enable-libsoxr --enable-libwavpack --enable-libvidstab --enable-libilbc --enable-libschroedinger --enable-libcaca --enable-opengl --enable-frei0r --enable-libquvi
但是我遇到了一个问题,FFmpeg二进制文件只有15.5MB,比官方版本要小得多,还有什么,它可以在我的第二台Mac上运行并且错误低于。< / p>
Library not loaded: /usr/local/lib/libx264.142.dylib
Referenced from: /Applications/CLI/ffmpeg
Reason: image not found
Trace/BPT trap: 5
然后我使用otool命令查看ffmpeg依赖的动态库。
otool -L /Applications/CLI/ffmpeg | grep local
/usr/local/lib/libSDL-1.2.0.dylib (compatibility version 12.0.0, current version 12.4.0)
/usr/local/lib/libx265.25.dylib (compatibility version 25.0.0, current version 1.2.0)
/usr/local/lib/libx264.142.dylib (compatibility version 0.0.0, current version 0.0.0)
/usr/local/lib/libvorbisenc.2.dylib (compatibility version 3.0.0, current version 3.10.0)
/usr/local/lib/libvorbis.0.dylib (compatibility version 5.0.0, current version 5.7.0)
/usr/local/lib/libogg.0.dylib (compatibility version 9.0.0, current version 9.2.0)
/usr/local/lib/libvo-aacenc.0.dylib (compatibility version 1.0.0, current version 1.3.0)
/usr/local/lib/libvidstab.0.9.dylib (compatibility version 0.9.0, current version 0.0.0)
/usr/local/lib/libtheoraenc.1.dylib (compatibility version 3.0.0, current version 3.2.0)
/usr/local/lib/libtheoradec.1.dylib (compatibility version 3.0.0, current version 3.4.0)
/usr/local/lib/libspeex.1.dylib (compatibility version 7.0.0, current version 7.0.0)
/usr/local/lib/libquvi.7.dylib (compatibility version 8.0.0, current version 8.1.0)
/usr/local/lib/libopus.0.dylib (compatibility version 6.0.0, current version 6.0.0)
/usr/local/lib/libopenjpeg.1.dylib (compatibility version 7.0.0, current version 7.0.0)
/usr/local/lib/libopencore-amrwb.0.dylib (compatibility version 1.0.0, current version 1.3.0)
/usr/local/lib/libopencore-amrnb.0.dylib (compatibility version 1.0.0, current version 1.3.0)
/usr/local/lib/libmp3lame.0.dylib (compatibility version 1.0.0, current version 1.0.0)
/usr/local/lib/libgsm.1.0.13.dylib (compatibility version 1.0.0, current version 1.0.13)
/usr/local/lib/libfreetype.6.dylib (compatibility version 18.0.0, current version 18.2.0)
/usr/local/lib/libfontconfig.1.dylib (compatibility version 10.0.0, current version 10.0.0)
/usr/local/lib/libfdk-aac.0.dylib (compatibility version 1.0.0, current version 1.4.0)
/usr/local/lib/libfaac.0.0.0.dylib (compatibility version 1.0.0, current version 1.0.0)
/usr/local/lib/libcaca.0.dylib (compatibility version 100.0.0, current version 100.19.0)
/usr/local/lib/libcelt0.2.dylib (compatibility version 3.0.0, current version 3.0.0)
/usr/local/lib/libbluray.1.dylib (compatibility version 8.0.0, current version 8.0.0)
/usr/local/lib/libass.5.dylib (compatibility version 6.0.0, current version 6.0.0)
我的大多数软件包都是由Homebrew安装的,而Homebrew将使用&#34; - enable-static --enable-shared&#34;来安装它们。我的猜测是:当我编译ffmpeg时,ffmpeg比使用动态库而不是静态库,所以二进制文件不能在其他Mac上工作。如何构建ffmpeg的静态二进制文件?感谢。
更新:在将具有静态库的所有dylib移动到其他字典之后,我成功构建了静态ffmpeg,并禁用了./configure无法找到的所有库。
./configure --extra-version=Chitanda_Eru --prefix=/Volumes/Chitanda_Eru/ --enable-gpl --enable-version3 --enable-nonfree --disable-shared --enable-static --enable-ffplay --disable-ffserver --enable-pthreads --enable-avisynth --enable-libvo-aacenc --enable-libfaac --enable-libfdk-aac --enable-libmp3lame --enable-libvorbis --enable-libx264 --enable-libxvid --enable-libtheora --enable-libcelt --enable-openssl --enable-libspeex --enable-postproc --enable-libvpx --enable-libgsm --enable-libopenjpeg --enable-filters --disable-indev=qtkit --enable-runtime-cpudetect --enable-bzlib --enable-zlib --enable-libopencore-amrnb --enable-libopencore-amrwb --enable-libvo-amrwbenc --enable-libtwolame --enable-libsoxr --enable-libwavpack --enable-libilbc --enable-opengl --enable-frei0r
答案 0 :(得分:0)
我不确定这会有所作为,尽管您可能会尝试在pkg_config='pkg-config --static'
命令的一部分的开头添加./configure
,并且可能在{{1}之后使用--enable-static
而不是之前。
虽然您的前缀目录通常应为--enable-libx264
,但您看起来好像在正确的位置有库。您可以尝试的另一件事是使用/usr/local
更新动态共享库安装名称,这可能会解决问题。
构建完成后使用:
install_name_tool
这会更新Mach-O二进制文件中记录的install_name_tool -id $PREFIX/lib/libx264.142.dylib libx264.142.dylib
。