Contents
This short tutorial shows students and new users how to install the FFmpeg tool on Ubuntu 20.04 | 18.04.
FFmpeg is a free, open-source, cross-platform multimedia framework that anyone can use to record, convert and stream audio and video online or through any application.
It includes libraries such as libavcodec, libavutil, libavformat, libavfilter, libavdevice, libswscale and libswresample, among others.
Applications and other tools can use the FFmpeg libraries to convert and play multimedia files, providing the best solution technically possible.
For more information about FFmpeg, please visit its home page .
When you are ready to install FFmpeg, follow the steps below:
Option 1: Install FFmpeg on Ubuntu
FFmpeg is available through the official Ubuntu repositories. It can be installed with Ubuntu's default package manager apt.
This is the easiest way to install FFmpeg on Ubuntu. However, the version available in the repositories may not be the latest one.
At the time of writing, the current FFmpeg version in the Ubuntu 18.04 | 16.04 repositories is 3.4.6.
The latest version on the FFmpeg website is 4.2.2.
To install the stable version that ships with the default Ubuntu repositories, simply run the following commands:
sudo apt update
sudo apt install ffmpeg
To verify that the package is installed and working properly, use the ffmpeg -versioncommand.
ffmpeg -version
The command above should produce output similar to the following lines:
Output:
ffmpeg version 3.4.6-0ubuntu0.18.04.1 Copyright (c) 2000-2019 the FFmpeg developers
built with gcc 7 (Ubuntu 7.3.0-16ubuntu3)
That's it.
The stable version of FFmpeg is now installed on your system and you can start using it.
Option 2: Install FFmpeg from a Repository
To get the latest version of FFmpeg, which includes a number of new filters, encoders and decoders, you may want to add a third-party PPA repository.
To do this, simply run the following commands:
sudo apt install software-properties-common sudo add-apt-repository --yes ppa:jonathonf/ffmpeg-4 sudo apt update sudo apt install ffmpeg
To verify that FFmpeg is installed, run the following command:
ffmpeg -version
It should print similar lines as shown below:
Output:
ffmpeg version 4.2.2-0york0~18.04 Copyright (c) 2000-2019 the FFmpeg developers
built with gcc 7 (Ubuntu 7.4.0-1ubuntu1~18.04.1)
configuration: --prefix=/usr --extra-version='0york0~18.04' --toolchain=hardened
With this method you install from a third-party PPA.
Option 3: Install with Snap
The easiest way to install the latest FFmpeg on Ubuntu is to use the snap packaging system.
Snaps are applications packaged with all their dependencies to run on all popular Linux distributions from a single build. They update automatically and roll back gracefully.
First, run the following commands to install the snap package manager, and then install FFmpeg.
sudo apt update
sudo apt install snapd
sudo snap install ffmpeg
After installing, use the command to verify the FFmpeg version.
This is how you install FFmpeg on Ubuntu.
Using FFmpeg
After installing FFmpeg, you can start using it to convert multimedia files to different formats.
For example, to convert from mp4 to webm format, simply run the following command.
ffmpeg -i input.mp4 output.webm
To convert an audio file from mp3 to ogg, run the following command:
ffmpeg -i input.mp3 output.ogg
There are more examples on the developer's site. Go there and learn how to use FFmpeg.
Conclusion:
This post showed how to install and use FFmpeg on Ubuntu 20.04 | 18.04.