Linux

How to Install and Use FFmpeg on Ubuntu 20.04

How to Install and Use FFmpeg on Ubuntu 20.04

FFmpeg is a collection of free and open source 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 audio / video streams, and resize videos.

This article describes how to install FFmpeg on Ubuntu 20.04.

Installing FFmpeg on Ubuntu

The official Ubuntu repository contains the FFmpeg package which can be installed with the apt package manager. This is the easiest way to install FFmpeg on Ubuntu. A new major version is released every six months, and the versions included in the repository usually lag behind the newest version of FFmpeg.

At the time of writing this article, the current version of FFmpeg available in the Ubuntu 20.04 repositories is 4.2.x. To install it, enter the following command as root or user with sudo privileges:

sudo apt update
sudo apt install ffmpeg

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

ffmpeg -version

The output will look like 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)

To print all available FFmpeg encoders and decoders:

ffmpeg -encoders
ffmpeg -decoders

There he is. FFmpeg is now installed on your system, and you can start using it.

When a new version is released, you can update the FFmpeg package via the command line or your desktop’s Software Update tool.

FFmpeg example

In this section, we will look at some basic examples of how to use the ffmpeg utility.

Basic conversion

When converting audio and video files with ffmpeg, you don’t need to specify the input and output formats. The input file format is detected automatically, and the output format is guessed from the file extension.

  • Convert video files from mp4 to webm:
    ffmpeg -i input.mp4 output.webm
  • Convert audio files from mp3 to ogg:
    ffmpeg -i input.mp3 output.ogg

Specifies the codec

When converting files, use the -c option to specify a codec. This can be a supported decoder / encoder name or a copy of a custom value that only copies the input stream.

  • Convert video files from mp4 to webm using libvpx video codec and libvorbis audio codec:
    ffmpeg -i input.mp4 -c:v libvpx -c:a libvorbis output.webm
  • Convert audio files from mp3 to ogg encoded with libopus codec.
    ffmpeg -i input.mp3 -c:a libopus output.ogg

Conclusion

We have shown you how to install FFmpeg on Ubuntu 20.04. You can now visit the official FFmpeg Documentation page and learn how to use FFmpeg to convert and your video and audio files.

If you run into any issues or have feedback, leave a comment below.

Related posts

How to Activate Dark Mode on Ubuntu 20.04 LTS

Howto

How to Install the Google Chrome Web Browser on Ubuntu 20.04

Linux

How to Install Apache Cassandra on Ubuntu 20.04

Linux

How to Install Go on Ubuntu 20.04

Linux

How to Add Elements to a List in Python (add, add and enter)

Linux

How to Install Eclipse IDE on Ubuntu 20.04

Linux

How to Grep Way for Various Strings and Patterns

Linux

How to ZSH and Oh-my-zsh Settings on Linux

Linux

How to install Linux Kernel 5.7 on Ubuntu

Linux