Install and Use FFmpeg on Ubuntu 20.04

In this article, we want to teach you how to Install and Use FFmpeg on Ubuntu 20.04.

FFmpeg is one such software platform, especially for multimedia files. With the help of its expanded libraries we can convert, edit, repair, and format any video format.

It is basically a command-line tool that uses commands to work on audio and video formats. With its advanced features, it supports a wide range of audio and video codec support.

How To Install and Use FFmpeg on Ubuntu 20.04

Before you start to install FFmpeg you need to log in to your server as a non-root user with sudo privileges. To do this, you can follow our article about the Initial Server Setup with Ubuntu 20.04.

Installing FFmpeg on Ubuntu 20.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

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.2.4-1ubuntu0.1 Copyright (c) 2000-2020 the FFmpeg developers
built with gcc 9 (Ubuntu 9.3.0-10ubuntu2)

Now you can see all available FFMpeg’s encoders and decoders type on Ubuntu 20.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
------
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
...

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

Using FFmpeg on Ubuntu 20.04

At 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 20.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 the FFmpeg, you can visit the official FFmpeg documentation page.

Conclusion

At this point, you learn to install and use FFmpeg on your server.

With FFmpeg you can:

  • Convert video to image and vice versa.
  • Speed control of audio and video files
  • Encode, decode, mux, demux, transcode, filter, etc various multimedia files.
  • Inclusion of logo or picture in a picture or video.
  • Display input and output and also record input from the webcam.

Hope you enjoy it.

Newsletter Updates

Enter your email address below and subscribe to our newsletter

Stay informed and not overwhelmed, subscribe now!