How to Install and Use FFmpeg on Ubuntu 20.04

Photo of author

By rasho

FFmpeg is a free and open-source collection of tools for handling multimedia files. It contains a set of shared audio and video libraries such as libavcodec, libavformat, and libavutil. With FFmpeg, you can convert between various video and audio formats, set sample rates, capture streaming audio/video, and resize videos.
In this tutorial, we will show you how to install FFmpeg on Ubuntu 20.04.

Prerequisites

Before starting installation, you must have a non-root user account on your server with sudo privileges.

Installing FFmpeg on Ubuntu 20.04

The FFmpeg package is included in standard Ubuntu repositories and can be installed using apt package manager. Currently, at the time of writing this article, the version of FFmpeg is 4.2.x available in the Ubuntu repositories.
Perform the following steps to install FFmpeg on Ubuntu 20.04:

1. Update package index list

First, you should update the package index list of your system

$ sudo apt update

2. Install FFmpeg

[ads1]
To install FFmpeg run the following command:

$ sudo apt install ffmpeg

3. Verify Installation

To verify the installation, use the ffmpeg -version command, which prints the FFmpeg version:

$ ffmpeg -version

The output should look something like this:

ffmpeg version 4.2.4-1ubuntu0.1 Copyright (c) 2000-2020 the FFmpeg developers
built with gcc 9 (Ubuntu 9.3.0-10ubuntu2)

To print all available FFmpeg’s encoders and decoders type:

$ ffmpeg -encoders
$ ffmpeg -decoders

That’s it. FFmpeg is now installed on your system, and you can start using it.

FFmpeg Examples

Following are the few basic examples for using the ffmpeg utility. While you convert the audio and video files using ffmpeg it will consider the files format itself.

  • Convert a video file from mp4 to webm:
    $ ffmpeg -i input.mp4 output.webm
  • Convert an audio file from mp3 to ogg:
    $ ffmpeg -i input.mp3 output.ogg

Use Specifying codecs

When converting files, use the -c option to specify the codecs. It can be a name of any supported decoder/encoder or a special value copy that simply copies the input stream.

    • Convert a video file from mp4 to webm using the libvpx video codec and libvorbis audio codec:

[ads1]

$ ffmpeg -i input.mp4 -c:v libvpx -c:a libvorbis output.webm
    • Convert an audio file from mp3 to ogg encoded with the libopus codec.
$ ffmpeg -i input.mp3 -c:a libopus output.ogg

Conclusion

You have learned how to install FFmpeg on Ubuntu 20.04 system. To know more about convert and your video and audio files visit the official FFmpeg Documentation page.
If you have any question of feedback, leave a comment below.

Leave a Comment