Install and Use FFmpeg on Ubuntu 20.04 | Easy Steps
In this article, we want to teach you how to Install and Use FFmpeg on Ubuntu 20.04. FFmpeg is one such software platform, especially for multimedia files. With the help of its expanded libraries, we can convert, edit, repair, and format any video format.
It is a command-line tool that uses commands to work on audio and video formats. With its advanced features, it supports a wide range of audio and video codecs. You can now proceed to the following steps on the Orcacore website to set up Install and Use FFmpeg on Ubuntu 20.04.
Before you start to install FFmpeg, you need to log in to your server as a non-root user with sudo privileges. To do this, you can follow our article about the Initial Server Setup with Ubuntu 20.04.
1. Install FFmpeg on Ubuntu 20.04
FFmpeg packages are available in the default Ubuntu repository. First, update your local package index with the following command:
sudo apt update
Then, you can install FFmpeg with the following command:
sudo apt install ffmpeg -y
After your installation is completed, you can verify it by checking its version:
ffmpeg -version
In your output, you will see something similar to this:
**Output**
ffmpeg version 4.2.4-1ubuntu0.1 Copyright (c) 2000-2020 the FFmpeg developers
built with gcc 9 (Ubuntu 9.3.0-10ubuntu2)
Available FFmpeg Encoders
Now you can see all available FFMpeg encoders and decoders on Ubuntu 20.04 with the following commands:
ffmpeg -encoders

Available FFmpeg Decoders
ffmpeg -decoders

At this point, you have installed FFmpeg on your Ubuntu 20.04. Now you can start using it.
2. Using FFmpeg on Ubuntu 20.04
At this step, we will show you how to use FFmpeg with some basic examples.
You don’t have to specify the input and output formats when you are converting the audio and video files with FFmpeg on Ubuntu 20.04.
The input file format is auto-detected, and the output format is guessed from the file extension.
For example, to convert a video file from MP4 to webm, you can use the following command:
ffmpeg -i input.mp4 output.webm
And to convert an audio file from MP3 to ogg, you can use the following command:
ffmpeg -i input.mp3 output.ogg
Also, you can use the –c parameter to specify the codecs when you are converting the files.
For example, you can convert a video file from MP4 to webm using the libvpx video codec and the libvorbis audio codec:
ffmpeg -i input.mp4 -c:v libvpx -c:a libvorbis output.webm
And to convert an audio file MP3 to ogg encoded with the libopus codec, you can use the following command:
ffmpeg -i input.mp3 -c:a libopus output.ogg
For more details and information about FFmpeg, you can visit the official FFmpeg documentation page .
Conclusion
At this point, you have learned to install and use FFmpeg on your server. With FFmpeg, you can:
- Convert video and audio files between various formats.
- Edit video and audio files, such as trimming, concatenating, and adding effects.
- Stream video and audio content over a network.
- Record video and audio from various sources.
Hope you enjoy it. You may also like to read the following articles:
Set up Monit Manager on Ubuntu 20.04
Install OpenJDK 19 on Ubuntu 20.04
Install Apache Maven on Ubuntu 20.04
Enable Brotli Compression on Ubuntu 20.04
FAQs
**What is FFmpeg?**
**FFmpeg** is a powerful, open-source multimedia framework used to **record, convert, stream, and manipulate audio and video**. It supports a wide range of formats and codecs.
**Is FFmpeg available in Ubuntu 20.04’s official repositories?**
Yes, FFmpeg is included in the **default Ubuntu 20.04 repositories**, making it easy to install using apt
.
Alternative Solutions for Installing FFmpeg on Ubuntu 20.04
While the apt
package manager provides a straightforward method for installing FFmpeg on Ubuntu 20.04, there are alternative approaches that offer different advantages, such as access to more recent versions or greater control over the build process. Here are two such alternatives:
1. Installing FFmpeg from the Snap Store
Snap is a package management system developed by Canonical, the company behind Ubuntu. It provides a sandboxed environment for applications, which can help to prevent conflicts with other software on your system. Installing FFmpeg from the Snap Store can give you a more up-to-date version than what’s available in the default Ubuntu repositories. This is particularly useful if you need features or bug fixes from newer releases.
Explanation:
Snaps are self-contained packages that include all their dependencies. This means that they don’t rely on the system’s libraries and can be installed without affecting other applications. Using Snap ensures you get a consistent version of FFmpeg across different Ubuntu systems.
Steps:
-
Install Snapd: If Snapd isn’t already installed (it usually is on Ubuntu), run:
sudo apt update sudo apt install snapd
-
Install FFmpeg via Snap:
sudo snap install ffmpeg
-
Verify Installation:
ffmpeg -version
This will show you the version of FFmpeg installed via Snap. You might need to adjust your
PATH
environment variable to ensure the snap version offfmpeg
is used if you have multiple versions installed. You can usually do this by explicitly calling the snap’s path:/snap/bin/ffmpeg -version
.
Code Example (Accessing FFmpeg through Snap):
Let’s say you want to convert an MP4 file to an AVI file using the Snap-installed FFmpeg. You’d run:
/snap/bin/ffmpeg -i input.mp4 output.avi
Pros:
- Potentially newer versions than the apt repository.
- Sandboxed environment reduces dependency conflicts.
- Easy installation and updates.
Cons:
- Snap packages can be larger than apt packages.
- May require adjusting
PATH
to use the Snap version. - Snap performance can sometimes be slightly slower than native packages.
2. Building FFmpeg from Source
For users who require the latest features, specific customizations, or a specific build configuration, compiling FFmpeg directly from its source code is a viable option. This provides the greatest degree of flexibility but also requires more technical expertise.
Explanation:
Building from source involves downloading the FFmpeg source code, configuring it with the desired options, and then compiling it into executable binaries. This allows you to enable or disable specific codecs, libraries, and features according to your needs. It also gives you access to the absolute latest version of FFmpeg, including any recent bug fixes or improvements.
Steps:
-
Install Dependencies:
Before you can build FFmpeg, you’ll need to install the necessary build tools and libraries. This includes a C compiler (like GCC), make, and various development libraries for the codecs you want to support.
sudo apt update sudo apt install build-essential checkinstall git libfaac-dev libmp3lame-dev libopencore-amrnb-dev libopencore-amrwb-dev libtheora-dev libvorbis-dev libx264-dev yasm libxvidcore-dev libvpx-dev
You may need to adjust this list depending on the specific codecs you require.
-
Download the FFmpeg Source Code:
Download the latest source code from the FFmpeg Git repository:
git clone https://git.ffmpeg.org/ffmpeg.git ffmpeg cd ffmpeg git checkout release/5.1 # or desired version
Replace "release/5.1" with the desired release branch.
-
Configure the Build:
Use the
configure
script to specify the build options. This is where you enable or disable specific codecs and features../configure --enable-gpl --enable-version3 --enable-nonfree --enable-libvpx --enable-libx264 --enable-libmp3lame
Important options:
--enable-gpl
: Enables GPL licensed code.--enable-nonfree
: Allows the use of non-free codecs (if you accept the licensing implications).--enable-libx264
,--enable-libvpx
,--enable-libmp3lame
: Enable specific encoders.
-
Build and Install:
make sudo checkinstall
Using
checkinstall
instead ofmake install
is highly recommended. It creates a Debian package, making it easier to uninstall FFmpeg later if needed.
Code Example (Using the self-compiled FFmpeg):
After compiling, the FFmpeg binaries are located in the ffmpeg
directory you cloned. To use them, you’d either need to add that directory to your PATH
or call the binaries directly:
./ffmpeg -i input.mov -c:v libx264 -crf 23 output.mp4
Pros:
- Greatest control over the build configuration.
- Access to the very latest features and bug fixes.
- Optimized for your specific hardware and software environment.
Cons:
- Most complex installation method.
- Requires a good understanding of build tools and dependencies.
- Time-consuming.
- Manual updates required.
These alternative methods offer different ways to Install and Use FFmpeg on Ubuntu 20.04, allowing users to choose the approach that best suits their needs and technical expertise. Remember to always consider the trade-offs between convenience, version availability, and control when selecting an installation method. Choosing the right approach for Install and Use FFmpeg on Ubuntu 20.04 can greatly impact your multimedia workflow.