1.安装RHEL/Centos7默认的开发工具,包含gcc,g++,make等等一系列工具
yum groupinstall "Development Tools"
2.创建生成资源目录
mkdir -p /opt/soft/ffmpeg
3.安装依赖yasm
yasm支持汇编优化,若不需要汇编优化的支持,可在编译选项中关闭yasm即可(--disable-yasm)。
tar -zxvf yasm-1.3.0.tar.gz cd yasm-1.3.0 ./configure --prefix="/opt/soft/ffmpeg/build" --bindir="/opt/soft/ffmpeg/bin" make make install
4.安装mp3依赖libmp3lame
1.下载lame源文件 https://sourceforge.net/projects/lame/files/lame/3.99/ 2.解压源文件 tar -zxvf lame-3.100.tar.gz 3.编译安装 cd lame-3.100 ./configure --prefix="/opt/soft/ffmpeg/build" --bindir="/opt/soft/ffmpeg/bin" --disable-shared make make install
5.安装opus依赖libopus
tar -xzvf opus-1.3.1.tar.gz cd opus-1.3.1 ./configure --prefix="/opt/soft/ffmpeg/build" --disable-shared make make install
6.安装ffmpeg
设置环境变量 export PATH=/opt/soft/ffmpeg/bin:$PATH export PKG_CONFIG_PATH=/opt/soft/ffmpeg/build/lib/pkgconfig tar -jxvf ffmpeg-snapshot.tar.bz2 cd ffmpeg ./configure --prefix=/usr/local/ffmpeg --enable-shared --enable-yasm --enable-gpl --enable-pthreads --enable-libmp3lame --enable-libopus make -j4 make insatll
错误说明
ERROR: opus not found using pkg-config
PKG_CONFIG_PATH配置不正确,解决方案是在安装libopus指定安装路径即可