1. Download the ffmpeg code and unzip it

#下载指定版本代码
wget http://www.ffmpeg.org/releases/ffmpeg-4.2.tar.gz
#或者 下载最新源码
wget https://ffmpeg.org/releases/ffmpeg-snapshot.tar.bz2
#或者 用git clone源码
git clone https://git.ffmpeg.org/ffmpeg.git ffmpeg

#解压
tar -zxvf ffmpeg-4.2.tar.gz

2. Enter the source code directory, compile and install

cd ffmpeg-4.2
./configure --prefix=/usr/local/ffmpeg --enable-openssl --disable-x86asm
make && make install

3. Configure environment variables, you can use ffmpeg anywhere

#Use vi to edit environment variables

vi /etc/profile

#Add environment variable at the last position

export PATH=$PATH:/usr/local/ffmpeg/bin

#:wq save and exit

# Refresh the resource to make it effective

source /etc/profile

4. Check the ffmpeg version and verify whether the installation is successful

ffmpeg -version