Reference:
https://www.cnblogs.com/lonelamb/p/11620906.html
https://blog.csdn.net/weixin_45617478/article/details/103336168
1. Install dependent libraries
sudo apt-get install -y autoconf automake build-essential git libass-dev libfreetype6-dev libsdl2-dev libtheora-dev libtool libva-dev libvdpau-dev libvorbis-dev libxcb1-dev libxcb-shm0-dev libxcb-xfixes0-dev pkg-config texinfo wget zlib1g-dev
apt install libavformat-dev
apt install libavcodec-dev
apt install libswresample-dev
apt install libswscale-dev
apt install libavutil-dev
apt install libsdl1.2-dev
sudo apt-get install yasm
sudo apt-get install libx264
2. Download ffmpeg source code compile and install
git clone git://source.ffmpeg.org/ffmpeg.git ffmpeg
./configure --enable-shared --prefix=/usr/local/ffmpeg --enable-gpl --enable-libx264 --extra-cflags=-I/usr/local/ffmpeg/include --extra-ldflags=-L/usr/local/ffmpeg/lib
make
make install
3. Add environment path
gedit /etc/profile
Add at the end
export PATH=$PATH:/usr/local/ffmpeg/bin/
4. Add dynamic link library path
gedit /etc/ld.so.conf
Add at the end:
/usr/local/ffmpeg/lib/
Then, to make it work:
sudo ldconfig
Be sure to add sudo, even under the root user.
5. Check the installation status
ffmpeg -v