基础环境
yum -y install gcc automake autoconf libtool make bzip2
yum install gcc gcc-c++ wget git
安装nasm
wget https://www.nasm.us/pub/nasm/releasebuilds/2.15.05/nasm-2.15.05.tar.bz2
tar xvf nasm-2.15.05.tar.bz2
cd nasm-2.15.05
./configure
make
make install
安装yasm
wget http://www.tortall.net/projects/yasm/releases/yasm-1.3.0.tar.gz
tar zxvf yasm-1.3.0.tar.gz
cd yasm-1.3.0
./configure
make
make install
安装x264
git clone https://code.videolan.org/videolan/x264.git
cd x264
./configure --prefix=/usr/local/x264/ --includedir=/usr/local/include --libdir=/usr/local/lib --enable-shared
make && make install
加入环境变量,执行:
export PKG_CONFIG_PATH=/usr/local/lib/pkgconfig:$PKG_CONFIG_PATH
安装ffmpeg
官网下载地址:https://www.ffmpeg.org/download.html
wget https://www.videohelp.com/download/ffmpeg-4.3.1.tar.xz
tar xvf ffmpeg-4.3.1.tar.xz
cd ffmpeg-4.3.1
./configure --prefix=/usr/local/ffmpeg --enable-gpl --enable-shared --enable-libx264
make && make install
配置信息
vi /etc/ld.so.conf
打开后加入以下两行:
/usr/local/ffmpeg/lib
/usr/local/lib
让配置生效
ldconfig
配置环境变量
vi /etc/profile
export FFMPEG_PATH=/usr/local/ffmpeg
export CLASSPATH=$FFMPEG_PATH/lib:$CLASSPATH
PATH=$FFMPEG_PATH/bin:$PATH
使环境生效
source /etc/profile
测试
ffmpeg -version
出来正确的版本信息即为成功