Home » Tutorial » How to install and use FFmpeg on Ubuntu 21.04 Linux Operating System

How to install and use FFmpeg on Ubuntu 21.04 Linux Operating System

Last updated Jun 25, 2021

The FFmpeg is the most potent and useful command-line tool on Linux system for multimedia files transcoding. You can use FFmpeg to convert multimedia files between various video and audio formats and resize videos. It has multiple audio and video libraries such as libavcode, libavformat, and libavutil.

In this tutorial, you will learn how to install FFmpeg into Ubuntu 21.04 Linux operating system. Here we will also show you how to install FFmpeg stable and latest version into various Ubuntu distro.

The same instruction you can use any other Ubuntu-based Linux distribution Operating Systems.

Prerequisites

  1. A Ubuntu 21.04 Linux installed system or Server.
  2. A non-root user with sudo privileges to add and configure the repository and install the package.

Install FFmpeg on Ubuntu 21.04 Linux OS

The FFmpeg package comes with Ubuntu default repository so you can install it by using an apt package manager and this is also a most comfortable way to install FFmpeg on Ubuntu 21.04 operating system.

The Ubuntu 21.04’s repository coming with FFmpeg 2.x or FFmpeg 3.x version, but currently FFmpeg is available with 4.x version also.

Follow below process to install FFmpeg on Ubuntu 21.04 Linux:

Step 01. First, update the package into the system using the following command:

$ sudo apt update

Step 02: Now, you can install FFmpeg by using the following command:

$ sudo apt install ffmpeg

Step 03: After installation of FFmpeg, you can validate it by checking the version of FFmpeg as shown below:

$ ffmpeg –version

The output should look something like this:

Output:
ffmpeg version 2.4.14-0ubuntu0.16.04.1 Copyright (c) 2000-2018 the FFmpeg developers
built with gcc 7 (Ubuntu 7.3.0-16ubuntu3)

You can also check available FFmpeg’s all encoders and decoders by using the following command:

$ ffmpeg –encoders
$ ffmpeg –decoders

Now, FFmpeg successfully installed into your Ubuntu 21.04 System or server.

Install FFmpeg 4.x on Ubuntu 21.04 Operating System

The new version of FFmpeg is 4.x, which is not coming with Ubuntu default distro.

Here, we will provide step by step process to install FFmpeg 4.x into Ubuntu 21.04 system or server.

The new version of FFmpeg 4.x is coming with various new filters, encoders and decoders and this is available from the Jonathon F’s PPA repository, so first, you need to add this repository into your system before starting the process of FFmpeg installation.

You can follow below steps to install FFmpeg 4.x on Ubuntu 21.04 Operating System:

Step 01. First, add jonathonf/ffmpeg-4 PPA:

$ sudo add-apt-repository ppa:jonathonf/ffmpeg-4
$ sudo apt-get update

Step 02. After adding the repository, use the apt package manager to install FFmpeg by using the following command.

$ sudo apt install ffmpeg

Step 03. After installation of FFmpeg you can verify it by using FFmpeg –version command:

$ ffmpeg –version
Output:
ffmpeg version 4.0.3-1~18.04.york0 Copyright (c) 2000-2018 the FFmpeg developers
built with gcc 7 (Ubuntu 7.3.0-27ubuntu1~18.04)

You will get following output:

Now, FFmpeg 4 installed on your Ubuntu system, and you can use it.

Use of FFmpeg

Here we will explain some of the primary examples of FFmpeg uses.

Basic Conversion

The good thing with FFmpeg is when you are going to convert of video or audio file from one format to another you no need to specify input or output format, It will automatically detect input file format, and for the output format, it will take from the file name extension.

Example 1 – Convert a video file from mp4 to webm:

$ ffmpeg –I input.mp4 output.webm

Example 2 – Convert an audio file from mp3 to ogg:

$ ffmpeg –I input.mp3 output.ogg

Specifying codecs

You can specify the codecs at the time of file conversion using FFmpeg using –c option. It can be the name of supported encoder/decoder or a unique value copy which simply copies the input stream.

Example 1 – you can convert a video file from mp4 format to webm using video codec “libvpx” and audio codec “libvorbis” using following command:

$ ffmpeg –I input.mp4 –c:v libvpx –c:a libvorbis output.webm

Example 2 – You can convert an audio file from mp3 format to ogg encoded with the codec “libopus”.

$ ffmpeg –I input.mp3 –c:a libopus output.ogg

Conclusion

Now, you are ready to install FFmpeg on Ubuntu 21.04 and any other Ubuntu-based Linux distribution. You can also visit the FFmpeg official documentation page and learn more about FFmpeg uses.

If you have any doubt, problem in installation or having feedback, feel free to leave comment.

Related Posts

How to Install CouchDB on Ubuntu 21.04 Linux Operating System

How to Install CouchDB on Ubuntu 21.04 Linux Operating System

The CouchDB is an open-source database system, managed by the Apache Software Foundation. It is fault-tolerant, and schema-free NoSQL database management system.   CouchDB store data in document or files with JSON data structure. Each document contains fields and...

How to add swap space on Ubuntu 21.04 Operating System

How to add swap space on Ubuntu 21.04 Operating System

The swap space is a unique space on the disk that is used by the system when Physical RAM is full. When a Linux machine runout the RAM it use swap space to move inactive pages from RAM. Swap space can be created into Linux system in two ways, one we can create a...

How to Install Nginx on Ubuntu 21.04 Server

How to Install Nginx on Ubuntu 21.04 Server

Nginx is the most potent, open-source, and a high-performance Web server. It can work as a reverse proxy server also, nowadays, is used by most of the most significant websites on the internet. People pronounced “engine x” for Nginx; it is the hot choice for every...

How to Install VirtualBox on Ubuntu 21.04 Linux

How to Install VirtualBox on Ubuntu 21.04 Linux

VirtualBox is an Open Source tool, known as a cross-platform virtualization application or software. It used to run multiple operating systems or virtual machines simultaneously on a single hardware. In this VirtualBox installation tutorial, we will explain the...

Follow Us

Our Communities

More on Ubuntu

The Ultimate Managed Hosting Platform
Load WordPress Sites in as fast as 37ms!

0 Comments

0 Comments

Submit a Comment

Your email address will not be published. Required fields are marked *

twelve − ten =

Shares