想将ffmpeg安装到Mac上,结果出现一堆堆的问题,耐住性子,一一解决。
ffmpeg有相关的MacOSX上的编译文档,可以参阅ffmpeg MacOSX Compile
原来想自己手动编译,不用brew来安装ffmpeg,后来在执行brew install ffmpeg的时候都出现来N多问题,于是回头,自己编译,解决问题。
brew我之前安装过,但是每次brew doctor的时候可以会出现以下提示,自己也没有在意,但是现在是需要解决的时候了,因为我安装ffmpeg总是提示各种错误。
按照ffmpeg编译文档编译
brew install automake fdk-aac git lame libass libtool libvorbis libvpx opus sdl shtool texi2html theora wget x264 xvid yasm
configure之后总是说已经安装的lib找不到,例如
ERROR: libass not found
总是不明所以,于是怀疑还是brew的问题,果断brew doctor,然后解决各种问题。
brew doctor
Please note that these warnings are just used to help the Homebrew maintainers
with debugging if you file an issue. If everything you use Homebrew for is
working fine: please don't worry and just ignore them. Thanks!
Warning: You have an outdated version of /usr/bin/install_name_tool installed.
This will cause binary package installations to fail.
This can happen if you install osx-gcc-installer or RailsInstaller.
To restore it, you must reinstall OS X or restore the binary from
the OS packages.
Warning: You seem to have osx-gcc-installer installed.
Homebrew doesn't support osx-gcc-installer. It causes many builds to fail and
is an unlicensed distribution of really old Xcode files.
Please run `xcode-select --install` to install the CLT.
通过命令查看本地的install_name_tool的信息
otool -L /usr/bin/install_name_tool
/usr/bin/install_name_tool:
/usr/lib/libSystem.B.dylib (compatibility version 1.0.0, current version 159.0.0)
解决办法就是下载MacOSX 系统,重新安装Essentials.pkg,我下载了5.33G的10.9.5版本的Mavericks
通过命令行来打开安装包,
open /Applications/Install\ OS\ X\ Mavericks.app/Contents/SharedSupport/InstallESD.dmg
如果已经加载,无需上面命令,继续执行
open /Volumes/OS\ X\ Install\ ESD/Packages/Essentials.pkg
otool -L /usr/bin/install_name_tool
/usr/bin/install_name_tool:
/usr/lib/libxcselect.dylib (compatibility version 1.0.0, current version 1.0.0)
/usr/lib/libSystem.B.dylib (compatibility version 1.0.0, current version 1197.1.1)
brew doctor
Your system is ready to brew.
./configure --prefix=/usr/local --enable-gpl --enable-nonfree --enable-libass --enable-libfdk-aac --enable-libfreetype --enable-libmp3lame --enable-libopus --enable-libtheora --enable-libvorbis --enable-libvpx --enable-libx264 --enable-libxvid --cc=/usr/bin/clang
但是make的时候又出现问题:
libavformat/os_support.c:66:12: error: implicit declaration of function 'inet_aton' is invalid in C99
[-Werror,-Wimplicit-function-declaration]
return inet_aton(str, add);
但是在这个页面发现不同的Rev,所以就尝试更新了代码,我下载的代码已经是比较新的代码了,版本号
./version.sh
N-66387-g9c843fb
通过git pull 下载最新的代码,版本
./version.sh
N-66417-g3bc0361
剩下的就是安装了sudo make install
可以在Mac下利用强大的ffmpeg了。