How to Install FFmpeg 5 on Ubuntu 20.04 LTS

FFmpeg is the leading free, open-source multimedia framework, able to decode, encode, transcode, mux, demux, stream, filter, and play nearly all multimedia files that have been created on any platform. FFmpeg compiles and runs on Linux, Mac OS X, Microsoft Windows, BSD systems, and Solaris.

In the following tutorial, you will learn how to install FFmpeg on Ubuntu 20.04 LTS Focal Fossa using the command line terminal and the FFmpeg 5 PPA by Rob Savory to get the latest up-to-date version for your desktop or Ubuntu headless server.

Update Ubuntu

First, update your system to avoid any conflicts.

sudo apt update && sudo apt upgrade

Import FFmpeg PPA

The best method for installing FFmpeg is to install the FFmpeg 5 PPA by Rob Savoury, whose PPA repositories are well known for supporting multiple software spread across various versions of Ubuntu.

The FFmpeg 5 requires packages from the existing 4 FFmpeg PPA, import this first.

  sudo add-apt-repository ppa:savoury1/ffmpeg4 -y

Next, import FFmpeg 5 PPA.

sudo add-apt-repository ppa:savoury1/ffmpeg5 -y

Once imported, run an APT update to reflect the new addition to your Ubuntu sources list.

sudo apt update

Next, quite a few upgrades are available for the dependencies required. Before proceeding any further, run a quick upgrade.

sudo apt upgrade

Install FFmpeg

With the PPA repository now added, run the following command to install FFmpeg.

sudo apt install ffmpeg

Next, verify the installation with the following terminal command:

ffmpeg -version

Example output:

How to Install and Use FFmpeg 5 on Ubuntu 20.04

If you want to see which FFmpeg’s decoders and encoders are available, type the following commands.

FFmpeg 5 encoders:

ffmpeg -encoders

FFmpeg 5 decoders:

ffmpeg -decoders

FFmpeg Basic Commands

Below are some basic commands for using FFmpeg. I would recommend visiting the official documentation to see a complete list of examples, as it is pretty extensive.

The primary command usage syntax for FFmpeg is below as an example.

ffmpeg [global_options] {[input_file_options] -i input_url} …{[output_file_options] output_url} …

Note that you will need to use these commands on each new file. There is no saving technique to date.

FFmpeg Conversion Example

To convert audio and video files with FFmpeg, you do not need to specify the input and output formats in your command. Instead, the input file format is auto-detected, and the output is given an output formulated from the file extension.

Convert a video file from mp4 to WebM.

ffmpeg -i existingfile.mp4 newfile.webm

Alternatively, it can also include more output files than just 1.

ffmpeg -i existingfile.wav newfile.mp3 newfile.ogg

Remember to check the list of supported formats using the following command:

ffmpeg -formats

FFmpeg Extract Audio from Video Example

If you want to extract the audio from a video file, this is done with the -vn input.

ffmpeg -i video.mp4 -vn audio.mp3

Note that this will convert the audio to the current bit rate of the original video file.

If you want to specify a new rate, enter the following example command.

ffmpeg -i video.mp4 -vn -ab 128k audio.mp3

Some examples of the most common bit rates are 96k, 128k, 192k, 256k, and 320k.

Comments and Conclusion

FFmpeg is an excellent multimedia software, the list is vast of what you can do with the software, and we only touched on a few choices out of dozens. Overall, this is a simple, lightweight program that works. We didn’t have an issue converting our files in our testing, and it was done rather quickly and efficiently.

To learn more about what FFmpeg can do, visiting their documentation page will help you with your goals.

Not what you were looking for? Try searching for additional tutorials.

6 thoughts on “How to Install FFmpeg 5 on Ubuntu 20.04 LTS”

  1. This doesn’t work on 21.10, Impish Indri. Running ffmpeg gives ffmpeg: error while loading shared libraries: cannot open shared object file: No such file or directory.

    • Hi Austin,

      This error occurs with a specific command or all of them.

      I will test this out. I do not use FFMPEG much anymore and have not installed this on any ubuntu 21.10 machines, originally this was done on 20.04 LTS. Thanks for the call-out. I will investigate.

      It sounds like something like sudo ldconfig. Usually, APT should take care of this. I will be shocked if it hasn’t; that doesn’t sound right.

      I will update the tutorial once I can confirm.

      Thanks again for the message.

      • Hi Joshua, the error happens with all commands I have tried, even just ffmpeg -version. I tried installing libmirclient9 package, which led to ffmpeg giving errors about missing symbols. I fixed it by building the source package.

        • WoW! the -version command?

          I just installed this and tested that command. It worked fine, along with converting a quick image.

          I will investigate this more, and I am a bit confused now since it seems to work on my Ubuntu 21.10 machine, this is indeed interesting you using an alternative desktop environment or anything else that has vastly modified your system? or is it a stock standard ubuntu 21.10? Just curious, and it could be helpful for others.

          Thanks again, Austin.

          • Stock Ubuntu, XFCE desktop.

            Update: I tried removing (my built version) and reinstalling with apt install ffmpeg; same result, complains about missing library. Then I tried removing again and reinstalling with snap install ffmpeg, and this time it worked. So, apt and snap install different versions. Something to be taken up with the package managers perhaps.

Leave a Comment