Install FFmpeg on Ubuntu 20.04: A Comprehensive Guide
FFmpeg offers a powerful, cross-platform toolkit to record, convert, and stream both audio and video. This tutorial explains how to get the most recent version up and running. While the focus is on Ubuntu 20.04, these steps are also applicable to Debian 10, CentOS 8, Fedora 32, or any Linux system running kernel version 3.2.0 or newer.
Prerequisites
- A fully updated instance of Ubuntu 20.04
- An active sudo user account (not root)
Understanding the Two FFmpeg Branches
FFmpeg maintains two source code branches: master and release. The master branch gets updates quicker, including bug fixes, new features, and security patches. It’s considered stable for daily use in nearly all scenarios.
Twice per year, the project issues a stable release that merges selected improvements from the master branch. During these intervals, point releases are distributed to fix critical bugs without introducing new features. This guide covers the setup for both branches, so you can choose the one that suits your needs.
Installing FFmpeg
⚠️ Important: Before proceeding, remove any previous FFmpeg installations to avoid possible version conflicts.
Create Directory for the Static Build
sudo mkdir -p /opt/ffmpeg
cd /opt/ffmpeg
Download the Static Archive
For the master branch:
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
For the release branch:
sudo wget https://johnvansickle.com/ffmpeg/releases/ffmpeg-release-amd64-static.tar.xz
sudo wget https://johnvansickle.com/ffmpeg/releases/ffmpeg-release-amd64-static.tar.xz.md5
md5sum -c ffmpeg-release-amd64-static.tar.xz.md5
Ensure that the md5sum
output confirms the file integrity with an “OK” message.
Extract the Archive
sudo tar xvf ffmpeg*.xz
cd ffmpeg-*-static
ls
The extracted files should resemble this:
- ffmpeg
- ffprobe
- GPLv3.txt
- manpages
- model
- qt-faststart
- readme.txt
Make FFmpeg Globally Accessible
sudo ln -s “${PWD}/ffmpeg” /usr/local/bin/
sudo ln -s “${PWD}/ffprobe” /usr/local/bin/
Testing FFmpeg
Download a Sample Video
cd ~
wget https://archive.org/download/BigBuckBunny_124/Content/big_buck_bunny_720p_surround.mp4 -O origin.mp4
Convert to a Streaming-Optimized Format
ffmpeg -i origin.mp4 -c copy -movflags +faststart streaming.mp4
Check the Output Using ffprobe
ffprobe streaming.mp4
If successful, you’ll see output similar to the following:
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
Conclusion
If you’re eager to explore more about FFmpeg, check out these helpful sources:
- The official FFmpeg website—for news, updates, and source code.
- The FFmpeg Static Builds page—offering downloads compatible with kernel 3.2.0 and above.
- The FFmpeg Wiki—a collection of guides created by the open-source community.