1. Official download

Go to: http://ffmpeg.org/download.html

Click on the link below

image.png

Copy the button link below

image.png

Switch to Linux, use wget command to download

wget -c https://ffmpeg.org/releases/ffmpeg-4.1.3.tar.bz2

After the download is complete, install the packages needed by ffmpeg first, and then compile ffmpeg, otherwise it will cause compilation errors

2. Install ffmpeg required packages

1.nasm

Download link: http://www.nasm.us/pub/nasm/releasebuilds/2.13.02/nasm-2.13.02.tar.xz

wget -c http://www.nasm.us/pub/nasm/releasebuilds/2.13.02/nasm-2.13.02.tar.xz

tar -vxf nasm-2.13.02.tar.xz

cd nasm-2.13.02 && ./configure && make && make install

2.lame

Download link: https://nchc.dl.sourceforge.net/project/lame/lame/3.100/lame-3.100.tar.gz

wget -c https://nchc.dl.sourceforge.net/project/lame/lame/3.100/lame-3.100.tar.gz

tar -vxf lame-3.100.tar.gz

cd lame-3.100 && ./configure --enable-shared && make && make install

3.x264

Download link: ftp://ftp.videolan.org/pub/videolan/x264/snapshots/last_stable_x264.tar.bz2

wget -c ftp://ftp.videolan.org/pub/videolan/x264/snapshots/last_stable_x264.tar.bz2

tar -vxf last_stable_x264.tar.bz2

cd x264-snapshot-20180729-2245-stable && ./configure --enable-shared --enable-static && make && make install

3. Set the PKG_CONFIG_PATH environment variable

export PKG_CONFIG_PATH=/usr/local/lib/pkgconfig:$PKG_CONFIG_PATH

4. Compile and install ffmpeg

  1. Unzip the source package
tar -vxf ffmpeg-4.1.3.tar.bz2
  1. Compile parameters, compile and install
cd ffmpeg-4.1.3 && ./configure --prefix=/usr/local/ffmpeg --enable-gpl --enable-version3 --enable-bzlib --enable-libmp3lame --enable-libx264 --enable-shared --enable-openssl --enable-nonfree && make && make install

5. Set environment variables

vim /etc/profile

Find export PATH, modify it and add a line

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

Load the configuration to take effect immediately

source /etc/profile

Test whether the environment variable is set successfully

ffmpeg -version

image.png

If the following interface appears, it means that there is an error in the environment reference library

image.png

The reason is that the lib directory is not loaded into the link to the system library. The system ld directory list is in /etc/ld.so.conf. Open the file and you will find that it references all of the following /etc/ld.so.conf.d/ .conf file, we only need to create a file and write the lib path

vim /etc/ld.so.conf.d/ffmpeg.conf

Add to the file

/usr/local/ffmpeg/lib

Load the configuration to take effect immediately

ldconfig

Test again whether the environment variable is set successfully

ffmpeg -version
Likes(0)

Comment list count 2 Comments

133****4204 3 years ago Reply

make~

184****7007 3 years ago Reply

make