(1)官网直接下载:
http://ffmpeg.org/download.html
(2)使用 Git 下载:(推荐使用该方式)
git clone https://git.ffmpeg.org/ffmpeg.git ffmpeg2、FFmpeg 的编译与安装
(1)FFmpeg 下载成功后进入 FFmpeg 源代码目录,运行配置命令:
./configure --prefix=/usr/local/ffmpeg --enable-gpl --enable-nonfree --enable-libfdk-aac --enable-libx264 --enable-libx265 --enable-filter=delogo --enable-debug --disable-optimizations --enable-libspeex --enable-videotoolbox --enable-shared --enable-pthreads --enable-version3 --enable-hardcoded-tables --cc=clang --host-cflags= --host-ldflags=
(2)执行编译、安装命令:
make &&sudo make install3、FFmpeg 的编译与安装可能遇到的问题
(1)ERROR: libfdk_aac not found
brew install fdk-aac
(2)ERROR: x264 not found
brew install x264
(3)ERROR: x265 not found
brew install x265
(4)ERROR: speex not found
brew install speex
(5)ERROR: pkg-config not found
brew install pkg-config
(6)编译 ffplay 需要 sdl2 的支持
brew install sdl2
(7)或者将以上所有命令写到一起
brew install fdk-aac&&brew install x264&&brew install x265&&brew install speex&&brew install pkg-config&&brew install sdl2
如若没有遇到问题,再次执行2.1和2.2即可。 (4)FFmpeg 环境变量配置
//第一步:编辑 base_profile 文件 vim ~/.bash_profile 注意:如果没有权限的话,则执行 sudo chmod 777 ~/.bash_profile //第二步:加上这两句 export PATH=$PATH:/usr/local/ffmpeg/bin export PKG_CONFIG_PATH=$PKG_CONFIG_PATH:/usr/local/lib/pkgconfig:/usr/lib/pkgconfig:/usr/local/Cellar/sdl2/2.0.14_1/lib/pkgconfig:/usr/local/ffmpeg/lib/pkgconfig //第三步:保存并退出 vim wq //第四步:更新环境变量 source ~/.bash_profile //第五步:检测是否配置成功 ffmpeg



