Join us now to get access to all our features. Once registered and logged in, you will be able to create topics, post replies to existing threads, give reputation to your fellow members, get your own private messenger, and so, so much more. It's also quick and totally free, so what are you waiting for?

How to Install and Use FFmpeg on Ubuntu 20.04


Staff member
Sep 20, 2021
Cheyenne Mountain Complex

How to Install and Use FFmpeg on Ubuntu 20.04​

FFmpeg is a free and open-source collection of tools for handling multimedia files. It contains a set of shared audio and video libraries such as libavcodec, libavformat, and libavutil. With FFmpeg, you can convert between various video and audio formats, set sample rates, capture streaming audio/video, and resize videos.

This article describes how to install FFmpeg on Ubuntu 20.04.

Installing FFmpeg on Ubuntu

The official Ubuntu repositories contain FFmpeg packages that can be installed with the apt package manager. This is the easiest way to install FFmpeg on Ubuntu. A new major version is released every six months, and the version included in the repositories usually lags behind the latest version of FFmpeg.
At the time of writing this article, the current version of FFmpeg available in the Ubuntu 20.04 repositories is 4.2.x. To install it, enter the following command as root or user with sudo privileges :

sudo apt update
sudo apt install ffmpeg
To verify the installation, use the FFmpeg -version command, which prints the FFmpeg version:
ffmpeg -version
The output should look something like this:
ffmpeg version 4.2.4-1ubuntu0.1 Copyright (c) 2000-2020 the FFmpeg developers
built with gcc 9 (Ubuntu 9.3.0-10ubuntu2)
To print all available FFmpeg’s encoders and decoders type:
ffmpeg -encoders
ffmpeg -decoders
That’s it. FFmpeg is now installed on your system, and you can start using it.
When a new version is released, you can update the FFmpeg package through the command-line or your desktop Software Update tool.

FFmpeg Examples​

In this section, we will look at some basic examples of how to use the FFmpeg utility

Basic conversion​

When converting audio and video files with FFmpeg, you do not have to specify the input and output formats. The input file format is auto-detected, and the output format is guessed from the file extension.

Convert a video file from mp4 to WebM:
ffmpeg -i input.mp4 output.webm
Convert an audio file from mp3 to OGG:
ffmpeg -i input.mp3 output.ogg

Specifying codecs​

When converting files, use the -c option to specify the codecs. It can be a name of any supported decoder/encoder or a special value copy that simply copies the input stream.

Convert a video file from mp4 to WebM using the libvpx video codec and libvorbis audio codec:
ffmpeg -i input.mp4 -c:v libvpx -c:a libvorbis output.webm

Convert an audio file from mp3 to Ogg encoded with the libopus codec.
ffmpeg -i input.mp3 -c:a libopus output.ogg