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 16.04, Ubuntu 18.04 and Ubuntu 19.04 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 like Linux Mint or Elementry OS.
An Ubuntu distro installed system or Server.
A non-root user with sudo privileges to add and configure the repository and install the package.
Installing FFmpeg on Ubuntu
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 operating system.
The Ubuntu 16.04’s repository coming with FFmpeg 2.x version, but currently FFmpeg is available with 4.x version also.
Follow below process to install FFmpeg 2.x on Ubuntu 16.04:
Step 01. First, update the package into the system using the following command:
Step 02: Now, you can install FFmpeg by using the following command:
Step 03: After installation of FFmpeg, you can validate it by checking the version of FFmpeg as shown below:
The output should look something like this:
You can also check available FFmpeg’s all encoders and decoders by using the following command:
Now, FFmpeg 2 successfully installed into your Ubuntu 16.04 System or server.
Follow below process to install FFmpeg 3.x on Ubuntu 18.04 and Ubuntu 19.04:
Step 01. First, update your system or server’s installed packages:
Step 02. Now you can install FFmpeg by using the following command:
Step 03. After installation of FFmpeg, you can validate it by checking the installed version into your system as shown below:
The output will look like this:
You can check all available FFmpeg’s encoders and decoders by using the following command:
Now, FFmpeg 3 installed into your system or server with Ubuntu 18.04 and Ubuntu 19.04 distro.
Installing FFmpeg 4.x on Ubuntu 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 18.04 and Ubuntu 19.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 18.04 and Ubuntu 19.04:
Step 01. First, add jonathonf/ffmpeg-4 PPA:
Step 02. After adding the repository, use the apt package manager to install FFmpeg by using the following command.
Step 03. After installation of FFmpeg you can verify it by using FFmpeg –version command:
You will get following output:
Now, FFmpeg 4 installed on your system, and you can use it.
Uses of FFmpeg
Here we will explain some of the primary examples of FFmpeg uses.
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:
Example 2 – Convert an audio file from mp3 to ogg:
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:
Example 2 – You can convert an audio file from mp3 format to ogg encoded with the codec “libopus”.
Now, you are ready to install FFmpeg on Ubuntu 16.04, Ubuntu 18.04, Ubuntu 19.04 and any other Ubuntu-based Linux distribution such as Linux mint or Elementry OS.
You can also visit the FFmpeg official documentation page and learn more about FFmpeg uses.