FFmpeg is the leading free, open-source multimedia framework, able to decode, encode, transcode, mux, demux, stream, filter, and play nearly all multimedia files that have been created on any platform. FFmpeg compiles and runs on Linux, Mac OS X, Microsoft Windows, BSD systems, and Solaris.
The following tutorial will teach you how to install FFmpeg on CentOS 9 Stream using the RPM Fusion free repository command line terminal.
Update CentOS Stream
First, update your system to avoid any conflicts when installing the package.
sudo dnf upgrade --refresh
Install EPEL/EPEL Next Repository
The first task is to install the EPEL repository, and the recommendation is to install both repositories.
First, enable the CRB repository.
sudo dnf config-manager --set-enabled crb
Next, install EPEL using the following (dnf) terminal command.
sudo dnf install \
https://dl.fedoraproject.org/pub/epel/epel-release-latest-9.noarch.rpm \
https://dl.fedoraproject.org/pub/epel/epel-next-release-latest-9.noarch.rpm
Install & Enable RPM Fusion Repositories
In the second step, install the RPM Fusion repo’s in your terminal with the following install options below.
Note, if you an open-source fan, only install the free repository. For all other users, install both.
Install/Enable the Free Repository (REQUIRED)
sudo dnf install --nogpgcheck https://mirrors.rpmfusion.org/free/el/rpmfusion-free-release-$(rpm -E %rhel).noarch.rpm -y
Install/Enable the Non-Free Repository (OPTIONAL)
sudo dnf install https://mirrors.rpmfusion.org/nonfree/el/rpmfusion-nonfree-release-$(rpm -E %rhel).noarch.rpm -y
Install FFmpeg
Using the following command, install FFmpeg.
sudo dnf install ffmpeg -y
For the development packages, use the following command.
sudo dnf install ffmpeg-free-devel -y
Optionally, verify the installation with the following terminal command.
ffmpeg -version
If you want to see which FFmpeg’s decoders and encoders are available, type the following commands.
FFmpeg encoders:
ffmpeg -encoders
FFmpeg decoders:
ffmpeg -decoders
More information can be found using the following commands.
FFmpeg formats:
ffmpeg -formats
FFmpeg codecs:
ffmpeg -codecs
FFmpeg bitstream filters:
ffmpeg -bsfs
FFmpeg protocols:
ffmpeg -protocols
FFmpeg filters:
ffmpeg -filters
FFmpeg pixel formats
ffmpeg -pix_fmts
FFmpeg channel layouts:
ffmpeg -layouts
FFmpeg audio sample formats:
ffmpeg -sample_fmts
FFmpeg Basic Commands
Below are some basic commands for using FFmpeg. I would recommend visiting the official documentation to see a complete list of examples, as it is pretty extensive.
The primary command usage syntax for FFmpeg is below as an example.
ffmpeg [global_options] [input_file_options] -i input_url …[output_file_options] output_url …
Note that you will need to use these commands on each new file. There is no saving technique to date.
FFmpeg Conversion Example
To convert audio and video files with FFmpeg, you do not need to specify your command’s input and output formats. Instead, the input file format is auto-detected, and the output is given an output formulated from the file extension.
Convert a video file from mp4 to WebM.
ffmpeg -i existingfile.mp4 newfile.webm
Alternatively, it can also include more output files than just 1.
ffmpeg -i existingfile.wav newfile.mp3 newfile.ogg
Remember to check the list of supported formats using the following command:
ffmpeg -formats
FFmpeg Extract Audio from Video Example
If you want to extract the audio from a video file, this is done with the “-vn“ input.
ffmpeg -i video.mp4 -vn audio.mp3
Note that this will convert the audio to the current bit rate of the original video file.
If you want to specify a new rate, enter the following example command.
ffmpeg -i video.mp4 -vn -ab 128k audio.mp3
Some examples of the most common bit rates are 96k, 128k, 192k, 256k, and 320k.
How to Update/Upgrade FFmpeg
FFmpeg was installed with RPM Fusion using the dnf package manager. This makes maintaining updates simple and quick by running the standard update command as you check your entire system for updates as follows.
sudo dnf update --refresh
How to Remove (Uninstall) FFmpeg
Remove FFmpeg using the following command.
sudo dnf autoremove ffmpeg ffmpeg-devel
Remove autoremove and replace it with remove for users that do not want to remove the unused dependencies from the installation. I would recommend keeping EPEL and RPM Fusion installed. Most users often need multiple packages from these repositories and are highly used within the community.
Comments and Conclusion
FFmpeg is an excellent multimedia software, the list is vast of what you can do with the software, and we only touched on a few choices out of dozens. Overall, this is a simple, lightweight program that works. We didn’t have an issue converting our files in our testing, which was done quickly and efficiently.