How to install ffmpeg on Ubuntu

FFmpeg is a command-line utility for transcoding multimedia files that is free and open-source. It includes libavcodec, libavformat, and libavutil, which are shared audio and video libraries. You may use FFmpeg to convert between different video and audio formats, as well as alter sample rates and resize videos.

If you’re searching for a guide on installing FFmpeg on the most recent release of Ubuntu, 22.04, you’ve come to the right spot. We’ve outlined the procedures for installing FFmpeg in this article.

Installing FFmpeg

FFmpeg packages are available in the official Ubuntu repository and may be installed using the apt package manager. This is the simplest method for installing FFmpeg on Ubuntu. Every six months, a new major version is produced, and the version in the repositories generally lags behind the most recent version of FFmpeg.

The latest version of FFmpeg present in the latest version of Ubuntu (22.04) repositories at the time of writing is 4.4.2. Installing it is pretty simple. To accomplish that, please stick to this article guide and follow all the steps provided herein:

Step 1: Update the system

Before deploying anything on your os, it is a good idea to update both the system and the current packages.

sudo apt update && sudo apt upgrade
update system
update system

Once the above command has been duly executed, you can proceed to step 2 below.

Step 2: Download and install FFmpeg.

FFmpeg packages are included by default in Ubuntu repositories and may be installed with the apt package manager. The following command line is used to install FFmpeg on Ubuntu 22.04.

sudo apt install ffmpeg
install ffmpeg
Install ffmpeg

During the installation process, you will get a prompt. Press’ Y’ to continue with the installation process.

Note: I had already installed it; hence you see the output above displays ffmpeg has already been installed.

Step 3: Check the installation

Use the following code to verify that FFmpeg was successfully installed.

ffmpeg -version
ffmpeg version
ffmpeg version

From the above output, you can tell that FFmpeg was successfully installed in our Ubuntu operating system.

Step 4: Decoders and Encoders

Encoders and Decoders are the fourth and last step. Use the instructions below to learn about FFmpeg’s available encoders and decoders.

ffmpeg -encoders

ffmpeg -decoders

Encoders output:

ffmpeg encoders
ffmpeg encoders

Decoders output:

ffmpeg decoders
ffmpeg decoders

From the outputs, you can tell the existing decoders and encoders.

That’s all. You have successfully installed FFmpeg on your Ubuntu OS.

You can see that FFmpeg is installed and operating correctly. Let’s attempt extracting metadata or audio from a video and converting a video or audio file to another format.

Get File Information

To acquire all the information about a media file in Ubuntu 22.04 LTS using FFmpeg, run the following command:

ffmpeg -i foss_linux.mp3
get file info
get file info

Ensure to substitute “foss linux.mp3” with the name of your audio or video file. You may obtain information about any video file using the same command above.

Remove Audio from a Video

The following command will be used to extract audio from any video file using FFmpeg:

ffmpeg -i foss_linux.mp4 -vn foss_linuxtuts.mp3
extract audio from video
Extract audio from video

You may retrieve the audio from any video file by using the simple command above. Simply replace “foss_linux.mp4” with the name of your video file, and then specify the new audio file name you want to extract.

Converting a Media File to a Different Format

You may convert your music or video clip to any other format you want by executing the following command. For instance, to convert an MP4 video to, say, WEBM format.

Converting a Media File to a Different Format

You may convert your music or video clip to any other format you want by executing the following command. For instance, to convert an MP4 video to, say, WEBM format. This is the simplest way to convert your media file to a different format.

Fundamental conversion

You are not required to specify the input and output formats when converting audio and video files using FFmpeg. The input file format is identified automatically, and the output format is predicted based on the file extension.

Transform an mp4 video to a WebM format file:

ffmpeg -i foss_linux.mp4 foss_linux.webm
convert video file to webm
convert video file to webm

Transform an mp3 audio to an ogg format file:

ffmpeg -i foss_linux.mp3 foss_linux.ogg
convert media file to ogg
convert media file to ogg

Choosing codecs

With the -c option, you may select the codecs to use when converting files. The codec can be any supported decoder/encoder name or a unique value copy that just copies the input stream. Convert an mp4 video file to WebM using the libvpx video and libvorbis audio codecs:

ffmpeg -i foss_linux.mp4 -c:v libvpx -c:a libvorbis output.webm
choose codecs while converting a video file
choose codecs while converting a video file

Transform an mp3 audio file to an ogg encoded file using the libopus codec:

ffmpeg -i foss_linux.mp3 -c:a libopus output.ogg
choose codecs while converting an mp3 file
choose codecs while converting an mp3 file


Use the code ‘sudo apt install ffmpeg’ to install FFmpeg on your Ubuntu 22.04 system. To ensure that FFmpeg was successfully installed, execute the command ffmpeg -version. Furthermore, FFmpeg includes some encoders and decoders; to test these, use the commands ffmpeg -encoders and ffmpeg -decoders.

This is how you install and use FFmpeg from the APT package repository on your Ubuntu 22.04 LTS system. This article guide also looked at some fundamental instructions for learning how to use FFmpeg on an Ubuntu 22.04 LTS system.


Related Articles


Please enter your comment!
Please enter your name here


More Articles Like This