A set of tools for managing multimedia files is called FFmpeg, which is free and open-source. Some features are offered by FFmpeg, including decoding, transcoding, changing the resolution of videos, and more.
It is a multi-platform framework that runs effectively on Windows, Linux, and macOS. In this tutorial, I will help you install FFmpeg Ubuntu 22.04. Additionally, you will discover how to use the
ffmpeg command-line tool to modify video resolution, specify codecs, and more.
Prerequisites to install FFmpeg Ubuntu
- Operating System: In this tutorial, I will use Ubuntu 22.04. This tutorial also works on older Ubuntu versions.
- Privileges: Check to see if sudo permissions are enabled on your Ubuntu.
Install FFmpeg Ubuntu 22.04
This tutorial will show you two ways to install it on Ubuntu. Each of them has different cons and pros. Choose the method that you think is easier for you and follow it.
Using Ubuntu APT
The fact that APT, or Advanced Package Tool, is pre-installed on every Ubuntu version makes me believe that it is the simplest way to install FFmpeg Ubuntu 22.04. It has FFmpeg packages, so you can install it on Ubuntu by executing the following straightforward commands with
You must execute this command to confirm the installation. If the FFmpeg Ubuntu versions are displayed in the terminal, your installation of FFmpeg Ubuntu was successful, and it is now ready for use. If not, you must review the commands you ran or choose the next step.
The output should look like this:
Installing FFmpeg by using Snap is also an easy method for you. By default, Snap isn’t installed on Ubuntu, but it’s a must-have application you need. It contains many packages, such as Pycharm, IntelliJ IDEA, Postman, and more.
Open your terminal by pressing
Ctrl+Alt+T and enter the following command to install FFmpeg Ubuntu via Snap:
Depending on the speed of your connection, the download can take some time. When finished, check the FFmpeg installation by executing this command in your terminal.
The output should look like this:
When these lines are printed on your terminal, it means that FFmpeg Ubuntu is installed on your Linux OS. You can now use it.
Using FFmpeg Ubuntu
As I indicated in the header, FFmpeg gives us access to a wide range of functions. We’ll look at some simple
ffmpeg usage examples in this section.
With the -c flag option, you can choose the codecs to use. The codec can be the name of any decoder or encoder that is supported or it can be a unique value copy that just copies the input stream.
- Using the
libvorbisaudio codec and
libvpxvideo codec, convert an
mp4video file to
Change Video File Resolution
ffmpeg also allows us to change the video resolution. If you want to change the video resolution to
1920x1080 you will run the following command.
After resizing the video, you can now play it in VLC Ubuntu. It supports not only video but also audio and more.
Changing The Formats Of Video Files
You don’t need to specify the input and output formats when using
ffmpeg to convert audio and video files. The output format is chosen from the output file extension that you specified, and the input file extension is automatically detected.
- Converting video file from
- Converting audio file from
Uninstall FFmpeg Ubuntu
If you don’t want to use this package anymore, you can consider uninstalling it on your Ubuntu. You need to execute the following commands to uninstall it.
- If you installed FFmpeg by using APT:
- If you used Snap to install FFmpeg:
You now know how to install FFmpeg Ubuntu 22.04 and uninstall it and use some simple samples. You can also visit its official documentation for more examples. If you are in need, you can comment below this tutorial, I will help you if I can.