FFmpeg is a free and open-source command line tool for transcoding multimedia files. FFmpeg contains a set of shared libraries for audio and video such as libavcodec, libavformat, and libavutil. With FFmpeg, you can convert between various video and audio formats, set the sample rate, and resize the video.
This tutorial covers the steps required to install FFmpeg on Rocky Linux 8 and CentOS 8.
Install FFmpeg on Rocky Linux 8 / CentOS 8
FFmpeg is not available in the default Rocky Linux 8 or CentOS 8 repositories. You can choose to build FFmpeg from source or install using dnf from the Negativo17 repository. We will use the second option which is install using dnf from the repository Negativo17
Complete the following steps to install FFmpeg on Rocky Linux 8 and CentOS 8:
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
2) Once the repository is enabled, install FFmpeg:
sudo dnf install ffmpeg
3) Verify the FFmpeg installation by checking the 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.4 “rao” Copyright (c) 2000-2021 the FFmpeg developers built with GCC 8 (GCC) … The command will also show the FFmpeg configuration
FFmpeg has been installed on your Rocky Linux 8 and CentOS 8 machine, and you can start using it.
Example of Using FFmpeg in Rocky Linux 8
In this section, we will look at some basic examples of how to use the utility
When converting audio and video files with ffmpeg, you don’t need to specify input and output formats. The input file format is detected automatically, and the output format is guessed based on 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
Using a codec
When converting files, you can specify the codec you want to use with the options
-c. The codec can be the name of each supported decoder/encoder or the value
copy which only copies the input stream.
Convert video files 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 audio files from mp3 to ogg encoded with libopus codec.
ffmpeg -i input.mp3 -c:a libopus output.ogg
You have successfully installed FFmpeg on Rocky Linux 8 or CentOS 8. You can now visit the page official FFmpeg Documentation and learn how to use FFmpeg to convert and your video and audio files.