How to Install and Use FFmpeg on CentOS 8

Posted 

3 min read

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.

This article describes how to install FFmpeg on CentOS 8.

Installing FFmpeg on CentOS 8

FFmpeg is not available in the default CentOS 8 repositories. You can choose to build the FFmpeg tools from the source or to install it using dnf from the Negativo17 repository. We’ll go with the second option.

Complete the following steps to install FFmpeg on CentOS 8:

  1. The Negativo17 repository depends on the EPEL and PowerTools repositories. Run the following commands as root or user with sudo privileges to enable the required repositories:

    sudo dnf install epel-releasesudo yum config-manager --set-enabled PowerToolssudo yum-config-manager --add-repo=https://negativo17.org/repos/epel-multimedia.repo
  2. Once the repositories are enabled, install FFmpeg:

    sudo dnf install ffmpeg
  3. Verify the FFmpeg installation by checking its version:

    ffmpeg -version

    At the time of writing this article, the current version of FFmpeg available in the Negativo17 repository is 2.8.15.

    ffmpeg version 4.2.2 Copyright (c) 2000-2019 the FFmpeg developers
    built with gcc 8 (GCC)
    ...

    The command will also show the FFmpeg configuration options.

That’s it. FFmpeg has been installed on your CentOS machine, and you can start using it.

Using FFmpeg

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

Basic conversion

When converting audio and video files with ffmpeg you do not have to specify the input and output formats. The input file format is auto detected and the output format is guessed from the file extension.

  • 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

Using 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:

    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

We’ve shown you how to install FFmpeg on CentOS 8. You should now visit the official FFmpeg Documentation page and learn how to use FFmpeg to convert and your video and audio files.

If you hit a problem or have feedback, leave a comment below.