FFmpeg is a free, open source collection of multimedia processing tools. It contains a set of common audio and video libraries such as libavcodec, libavformat, and libavutil. With FFmpeg, you can convert video and audio to various formats, set sample rates, record streaming audio / video and resize video.
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 build the FFmpeg tools from source, or install dnf from the Negativo17 repository. We’ll go with the second option.
Follow these steps to install FFmpeg on CentOS 8:
- The Negativo17 repository depends on the EPEL and PowerTools repositories. Run the following commands as root or a user with sudo privileges to enable the required repositories:
sudo dnf install epel-release sudo yum config-manager --set-enabled PowerTools sudo yum-config-manager --add-repo=https://negativo17.org/repos/epel-multimedia.repo
- Once the repositories are enabled, install FFmpeg:
sudo dnf install ffmpeg
- Check your FFmpeg installation by checking its version:
At the time of this writing, 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 all. FFmpeg has been installed on your CentOS machine and you can start using it.
In this section, we’ll go over some basic examples of using the ffmpeg utility.
When converting audio and video files with ffmpeg, you do not need to specify the input and output formats. The input file format is automatically detected, and the output format is determined by the file extension.
- Convert video file from mp4 to webm:
ffmpeg -i input.mp4 output.webm
- Convert audio file from mp3 to ogg:
ffmpeg -i input.mp3 output.ogg
When converting files, use the -c option to specify the codecs. This can be the name of any supported decoder / encoder, or the special value copy that simply copies the input stream.
- Convert video file 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 file from mp3 to ogg encoded with libopus codec.
ffmpeg -i input.mp3 -c:a libopus output.ogg
We showed 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 your video and audio files.
If you run into an issue or have feedback, please leave a comment below.