ffmpeg 下载、编译与安装

下载

git clone https://git.ffmpeg.org/ffmpeg.git ffmpeg

编译, 安装

# 编译前准备
brew install yasm
brew install fdk-aac
brew install x264
brew install x265
brew install speex
brew install pkg-config

# 查看 ffmpeg 信息
./configure --help

# 配置
./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= 

# 编译、安装
make && sudo make install

# 配置环境变量
export PKG_CONFIG_PATH="/usr/local/lib/pkgconfig:/usr/lib/pkgconfig:/usr/local/SDL2/lib/pkgconfig:/usr/local/ffmpeg/lib/pkgconfig:$PKG_CONFIG_PATH"
export PATH="/usr/local/ffmpeg/bin:$PATH"