FFmpeg学习记录
一:编译ffmpeg
环境:
Mac OS 10.14
Apple LLVM version 10.0.0 (clang-1000.11.45.2)
Target: x86_64-apple-darwin18.0.0
Thread model: posix
InstalledDir: /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin
编译:
依赖:利用brew来安装相应的依赖库
brew install automake fdk-aac git libtool libvorbis libvpx opus sdl2 shtool yasm texi2html theora wget x264 xvid lame libass
开始编译步骤:
git clone http://source.ffmpeg.org/git/ffmpeg.git ffmpeg
cd ffmpeg
./configure --prefix=/usr/local/Cellar --enable-gpl --enable-nonfree --enable-libass --enable-libfdk-aac --enable-libfreetype --enable-libmp3lame --enable-libopus --enable-libtheora --enable-libvorbis --enable-libvpx --enable-libx264 --enable-sdl --enable-libxvid --extra-ldflags=-L/usr/local/lib
make && make install
这样会在/usr/local/Cellar路径下生产相应的静态库文件和头文件,而在源代码文件夹下会生成FFmpeg等二进制程序;此时可以将Cellar下的对应静态库软链接到/usr/local/lib下,对应的头文件软链接到/usr/local/include下。
如果报错找不到相应的库文件可以加入
--extra-ldflags=-L/usr/local/lib
测试是否安装成功
用xcode新建一个Command line tool工程,语音用c++