FFmpeg is a command-line cross-platform software project that is used to operate the audio, video, multimedia streams, and files. It is a multimedia framework that consists of various libraries and programs. It converts the audio and video formats. FFmpeg can perform several tasks such as encoding, decoding, streaming, and filtering, etc.
As FFmpeg is free and cross-platform, therefore, it is compatible with all operating systems like Linux, Mac, and Windows. This descriptive writeup illustrates how to install and use the FFmpeg on Ubuntu 22.04. The outcomes of this article will be:
- How to install the FFmpeg on Ubuntu 22.04
- How to use the FFmpeg on ubuntu 22.04
How to Install the FFmpeg on Ubuntu 22.04
FFmpeg is a cross-platform software project that consists of libraries and programs. FFmpeg can be installed via the Ubuntu official repository. To install the FFmpeg through the official apt repository, follow the step-by-step process given as below:
Step 1: Update and upgrade system’s packages
You should update and upgrade the system’s packages repository for updated packages. To update and upgrade the system’s packages, run the following command in terminal:
$ sudo apt update && sudo apt upgrade
The packages installed on our system are already updated and upgraded.
Step 2: Install FFmpeg
When the system is updated successfully, now you can install FFmpeg on Ubuntu 22.04. To install the FFmpeg on Ubuntu 22.04, type and execute the following command:
$ sudo apt install ffmpeg
It can be observed from the output that “FFmpeg” is installed on Ubuntu 22.04.
Step 3: Check Version
To confirm the installation of FFmpeg on Ubuntu 22.04, a user can verify the installed version of the FFmpeg application. To verify the installation of FFmpeg on Ubuntu, run the following command:
$ ffmpeg -version
It is verified that the installed version of FFmpeg on Ubuntu 22.04 is 4.4.1.
How to use FFmpeg on Ubuntu 22.04
After the successful installation of FFmpeg on Ubuntu 22.04, you can use it for numerous multimedia related operations. It fetches the video information, reduces the file size, and converts the video into other formats. The following examples show the common uses of FFmpeg on Ubuntu 22.04.
Fetch audio from video file
FFmpeg can be used to fetch the audio from a video file using the encoder, and decoder. The following command will fetch the audio from a video file named video.mp4:
$ ffmpeg -i video.mp4 -vn audio.mp3
Here, -i is a video command while -vn is used to disable the video audio. The output shows that audio is extracted from a video file.
Extract Images from .mp4 file
FFmpeg also extracts the images from .mp4 file. However, to extract the .png image from .mp4 file, run the following command in the terminal. Here, the -r represents the frame rate. However, the -f represents the output format. While image-%2d.png represents the extracted file name.
$ ffmpeg -i video.mp4 -r 1 -f image2 image-%2d.png
From output, you can see that images have been extracted successfully from a video file.
Convert the video file into another format
The FFmpeg can also be used to convert the file formats. You can easily convert the video format into others such as mp4, avi etc. For instance, we have converted an mp4 file to avi file via the following command:
$ ffmpeg -i video.mp4 video.avi
The output showed that the .mp4 file is converted into .avi format successfully
How to remove FFmpeg from Ubuntu 22.04
If you don’t want to use the FFmpeg on Ubuntu 22.04, you can remove the FFmpeg from the Linux system. To remove the FFmpeg from Ubuntu 22.04, run the following command in the terminal:
$ sudo apt remove ffmpeg
The output showed that FFmpeg is removed successfully from Ubuntu 22.04.
The FFmpeg can be installed on Ubuntu 22.04 using the system’s official repository. FFmpeg is a cross-platform software project that consists of libraries and programs. It is a widely used transcoder that converts audio formats to video and vice versa. This article aims to install and use the FFmpeg on the latest release of Ubuntu 22.04. FFmpeg can be used to fetch the video information, reducing the file size and also by converting the video formats.