In this tutorial, we will show you how to install latest FFmpeg on Ubuntu 20.04. We will install latest static build of FFmpeg.
FFmpeg is the leading multimedia framework, able to decode, encode, transcode, mux, demux, stream, filter and play pretty much anything that humans and machines have created. It supports the most obscure ancient formats up to the cutting edge.
Prerequisites
- Dedicated server with Ubuntu 20.04 OS installed
- root or non-root sudo user
Master branch of FFmpeg
In this tutorial, we will install master branch of FFmpeg. There are two branches of FFmpeg, master and release. The master branch receives faster bug fixes, additional features, and security patches.
Let’s start with the installation.
Step 1 – Create a directory
First, we need to create a directory to store the static build.
# sudo mkdir -p /opt/ffmpeg
# cd /opt/ffmpeg
Step 2 – Download the archive
We will download the master build.
# sudo wget https://johnvansickle.com/ffmpeg/builds/ffmpeg-git-amd64-static.tar.xz
# sudo wget https://johnvansickle.com/ffmpeg/builds/ffmpeg-git-amd64-static.tar.xz.md5
# md5sum -c ffmpeg-git-amd64-static.tar.xz.md5
Verify that md5sum returns an OK message before proceeding with the installation.
Step 3 – Extract the static build from the archive.
# sudo tar xvf ffmpeg*.xz
# cd ffmpeg-*-static
# ls
You will see something like this:
ffmpeg ffprobe GPLv3.txt manpages model qt-faststart readme.txt
Step 4 – Install the binaries globally.
# sudo ln -s “${PWD}/ffmpeg” /usr/local/bin/
# sudo ln -s “${PWD}/ffprobe” /usr/local/bin/
Step 5 – Test FFmpeg
1. Go to your home folder and download a video file.
# cd ~
# wget https://archive.org/download/BigBuckBunny_124/Content/big_buck_bunny_720p_surround.mp4 -O origin.mp4
2. Convert it to streaming compatible version.
# ffmpeg -i origin.mp4 -c copy -movflags +faststart streaming.mp4
3. Verify the resulting video with ffprobe:
# ffprobe streaming.mp4
If you see output like this, FFmpeg is working properly.
Input #0, mov,mp4,m4a,3gp,3g2,mj2, from ‘streaming.mp4’:
Metadata:
major_brand : isom
minor_version : 512
compatible_brands: isomiso2avc1mp41
title : Big Buck Bunny – https://archive.org/details/BigBuckBunny_124
encoder : Lavf58.49.100
comment : license:http://creativecommons.org/licenses/by/3.0/
Duration: 00:09:56.50, start: 0.000000, bitrate: 829 kb/s
Stream #0:0(und): Video: h264 (Constrained Baseline) (avc1 / 0x31637661), yuv420p, 640×360 [SAR 1:1 DAR 16:9], 697 kb/s, 24 fps, 24 tbr, 12288 tbn, 48 tbc (default)
Metadata:
handler_name : VideoHandler
Stream #0:1(und): Audio: aac (LC) (mp4a / 0x6134706D), 44100 Hz, stereo, fltp, 128 kb/s (default)
Metadata:
handler_name : SoundHandler
That’s it. We have successfully install latest FFmpeg on Ubuntu 20.04.