How to Install and Use FFmpeg on Ubuntu 20.04 2024

How to Install and Use FFmpeg on Ubuntu

Learn how to install FFmpeg on Ubuntu 20.04 – the free and open-source software suite for multimedia handling. FFmpeg offers a range of shared audio and video libraries including libavcodec, libavformat, and libavutil to easily convert media files to different formats, adjust sample rates, capture streaming content, and resize videos.

Follow this step-by-step guide to effortlessly install FFmpeg on Ubuntu 20.04.

Installing FFmpeg on Ubuntu is simple using the apt package manager, which provides FFmpeg packages in the official Ubuntu repositories. However, the version of FFmpeg included in these repositories may not be the latest, as a new major release is only made available every six months.

As of the time of writing this article, Ubuntu 20.04 repositories offer version 4.2.x of FFmpeg. To install it, simply enter the following command as a user with sudo privileges or as root:

sudo apt update
sudo apt install ffmpeg

You can check if FFmpeg is installed correctly by using the command ffmpeg -version, which will display the version of FFmpeg:

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)

Type the following to display a list of all encoders and decoders available in FFmpeg:

ffmpeg -encoders
ffmpeg -decoders

You have successfully installed FFmpeg on your system and it’s ready for use. In case a new version becomes available, you can easily update the FFmpeg package either through the command-line or by using your desktop Software Update tool.

FFmpeg Examples

This section provides some simple examples to demonstrate how to use the ffmpeg utility.

Basic conversion

You don’t need to indicate the input and output formats when using ffmpeg to transform audio and video files. The tool automatically detects the input file format and guesses the output format based on the file extension.

Here are examples of how to convert a video file from mp4 to webm and an audio file from mp3 to ogg using ffmpeg:

  • To convert a video file from mp4 to webm, use the command:
ffmpeg -i input.mp4 output.webm
  • To convert an audio file from mp3 to ogg, use the command:
ffmpeg -i input.mp3 output.ogg

Specifying codecs

To specify the codecs while converting files, you can use the -c option. The codecs can be any supported decoder/encoder or “copy,” a special value that duplicates the input stream.

Here are two examples:

  • To convert a video file from mp4 to webm format, you can use the libvpx video codec and the libvorbis audio codec with the following command:
ffmpeg -i input.mp4 -c:v libvpx -c:a libvorbis output.webm
  • To convert an audio file from mp3 to ogg format, encoded with the libopus codec, you can use the following command:
ffmpeg -i input.mp3 -c:a libopus output.ogg

Conclusion

In conclusion, this guide has provided a comprehensive tutorial on how to install FFmpeg on Ubuntu 20.04. Now, you can explore the powerful features of FFmpeg and learn how to effortlessly convert your video and audio files. For more information on FFmpeg and its functionalities, please visit the official FFmpeg Documentation page.

If you encounter any difficulties during the installation process or have any feedback, please feel free to leave a comment below.

Alex

Alex

Hey there! My name is Alex and I'm a professional content writer. I'm also lucky enough to be part of an amazing trio team! I absolutely love what I do and I'm passionate about creating content that engages, informs, and entertains. Whether it's writing blog posts, website copy, or social media content, I always strive to deliver high-quality work that exceeds expectations.

We will be happy to hear your thoughts

Leave a reply

TrioGuide
Logo