1、安装yasm
# wget http://www.tortall.net/projects/yasm/releases/yasm-1.3.0.tar.gz
# tar -xvf yasm-1.3.0.tar.gz
# cd yasm-1.3.0
编译安装yasm,安装ffmpeg必须要安装的
# ./configure && make && make install
2、安装x264
安装nasm
# wget http://www.nasm.us/pub/nasm/releasebuilds/2.13.03/nasm-2.13.03.tar.xz --no-check-certificate
# tar xvJf nasm-2.13.03.tar.xz
# cd nasm-2.13.03
# ./configure && make && make install
安装x264
# yum -y install git
# git clone https://code.videolan.org/videolan/x264.git #下载x264安装包
# cd x264
# ./configure --prefix=/usr/local/x264 --enable-shared --enable-static
# make && make install
添加环境变量
# vim /etc/profile
export PKG_CONFIG_PATH=/usr/local/x264/lib/pkgconfig
# source /etc/profile
4、安装ffmpeg
# wget http://ffmpeg.org/releases/ffmpeg-5.1.3.tar.gz
# tar -xvf ffmpeg-5.1.3.tar.gz
# cd ffmpeg-5.1.3
# ./configure --prefix=/usr/local/ffmpeg5.1.3 --enable-libx264=/usr/local/pkg-config --enable-gpl --extra-cnclude --extra-ldflags=-L/usr/local/x264/lib
# make && make install
# vim /etc/ld.so.conf #文件最后添加以下内容
/usr/local/x264/lib
# ldconfig
# /usr/local/ffmpeg5.1.3/bin/ffmpeg -v #安装成功,查看环境变量