Install and Use FFmpeg on Ubuntu 22.04

This tutorial intends to teach you How To Install and Use FFmpeg on Ubuntu 22.04.

FFmpeg is a powerful collection of libraries and tools that allows you to work with media files. You can use it to convert video files between different formats, re-encode a video file with a different codec, extract image frames from a video file, and much more.

FFmpeg is available on multiple platforms, including Windows, macOS, and various Linux distributions.

Steps To Install and Use FFmpeg on Ubuntu 22.04

To complete this guide, you must log in to your server as a non-root user with sudo privileges. To do this, you can follow our guide on Initial Server Setup with Ubuntu 22.04.

Install FFmpeg on Ubuntu 22.04

FFmpeg packages are available in the default Ubuntu repository.

First, update your local package index with the following command:

sudo apt update

Then, you can install FFmpeg with the following command:

sudo apt install ffmpeg -y

After your installation is completed, you can verify it by checking its version:

ffmpeg -version

In your output you will see something similar to this:

Output
ffmpeg version 4.4.2-0ubuntu0.22.04.1 Copyright (c) 2000-2021 the FFmpeg developers
built with gcc 11 (Ubuntu 11.2.0-19ubuntu1)
...

List Available FFMpeg’s encoders and decoders

Now you can see all available FFMpeg’s encoders and decoders types on Ubuntu 22.04 with the following commands:

ffmpeg -encoders
Output
Encoders:
 V..... = Video
 A..... = Audio
 S..... = Subtitle
 .F.... = Frame-level multithreading
 ..S... = Slice-level multithreading
 ...X.. = Codec is experimental
 ....B. = Supports draw_horiz_band
 .....D = Supports direct rendering method 1
 ------
 V..... a64multi             Multicolor charset for Commodore 64 (codec a64_multi)
 V..... a64multi5            Multicolor charset for Commodore 64, extended with 5th color (colram) (codec a64_multi5)
 V..... alias_pix            Alias/Wavefront PIX image
 V..... amv                  AMV Video
 V..... apng                 APNG (Animated Portable Network Graphics) image
 V..... asv1                 ASUS V1
 V..... asv2                 ASUS V2
...
ffmpeg -decoders
Output
Decoders:
 V..... = Video
 A..... = Audio
 S..... = Subtitle
 .F.... = Frame-level multithreading
 ..S... = Slice-level multithreading
 ...X.. = Codec is experimental
 ....B. = Supports draw_horiz_band
 .....D = Supports direct rendering method 1
 ------
 V....D 012v                 Uncompressed 4:2:2 10-bit
 V....D 4xm                  4X Movie
 V....D 8bps                 QuickTime 8BPS video
 V....D aasc                 Autodesk RLE
 V....D agm                  Amuse Graphics Movie
 VF...D aic                  Apple Intermediate Codec
 V....D alias_pix            Alias/Wavefront PIX image
 V....D amv                  AMV Video
 V....D anm                  Deluxe Paint Animation
 V....D ansi                 ASCII/ANSI art
 VF...D apng                 APNG (Animated Portable Network Graphics) image
 V....D arbc                 Gryphon's Anim Compressor
...

At this point, you have installed FFmpeg on your Ubuntu 22.04. Now you can start using it.

How To Use FFmpeg on Ubuntu 22.04

In this step, we will show you how to use FFmpeg with some basic examples.

You don’t have to specify the input and output formats when you are converting the audio and video files with FFmpeg on Ubuntu 22.04.

The input file format is auto-detected, and the output format is guessed from the file extension.

For example, to convert a video file from mp4 to webm you can use the following command:

ffmpeg -i input.mp4 output.webm

And to convert an audio file from mp3 to ogg you can use the following command:

ffmpeg -i input.mp3 output.ogg

Also, you can use the –c parameter to specify the codecs when you are converting the files.

For example, you can convert a video file from mp4 to webm using the libvpx video codec and the libvorbis audio codec:

ffmpeg -i input.mp4 -c:v libvpx -c:a libvorbis output.webm

And to convert an audio file mp3 to ogg encoded with the libopus codec, you can use the following command:

ffmpeg -i input.mp3 -c:a libopus output.ogg

For more details and information about FFmpeg, you can visit the official FFmpeg documentation page.

Conclusion

At this point, you have learned to Install and Use FFmpeg on Ubuntu 22.04.

Hope you enjoy using it. You may be interested in these articles:

Install aaPanel on Ubuntu 22.04

Install Dropbox on Ubuntu 22.04

Fix Waiting for Cache Lock Error on Ubuntu

Newsletter Updates

Enter your email address below and subscribe to our newsletter

Leave a Reply

Stay informed and not overwhelmed, subscribe now!