You will learn how to install and Use FFmpeg on CentOS 8.
FFmpeg is a free and open-source software project consisting of a suite of libraries and programs for handling video, audio, and other multimedia files and streams. 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.
So, at its core is the command-line ffmpeg tool itself, designed for processing of video and audio files.
FFmpeg is a cross-platform application as it can run on Linux, macOS, Windows, BSDs, Solaris, etc, under wide variety of build environments, configurations and machine architectures.
These are the main FFmpeg building blocks:
• First, ffmpeg. Command line tool to convert multimedia files between formats
• ffplay – which is Simple media player based on SDL and the FFmpeg libraries
• Finally, ffprobe – Simple multimedia stream analyzer
The app also contain Libraries for developers – libavutil, libavcodec, libavformat, libavdevice, libavfilter, libswscale and libswresample.
Step 1: Install EPEL repository
First you have to install the EPEL repository, which contains a bunch of extra packages not shipped with the base CentOS 8 install media.
Extra Packages for Enterprise Linux (or EPEL) is a Fedora Special Interest Group that creates, maintains, and manages a high quality set of additional packages for Enterprise Linux, including, but not limited to, Red Hat Enterprise Linux (RHEL), CentOS and Scientific Linux (SL), Oracle Linux (OL).
You need to enable EPEL on CentOS before you enable RPM Fusion.
The EPEL repository can be installed using YUM or DNF, whichever you’re more comfortable with.
Execute the following command:
# yum install https://dl.fedoraproject.org/pub/epel/epel-release-latest-8.noarch.rpm
Step 2: Install RPM Fusion repository
RPM Fusion has two repositories we will be using, a free one and a nonfree one. They are both free to use, but the non-free repository contains software that may not be covered under open source licensing.
Using YUM, you can install RPM Fusion repository:
yum install https://download1.rpmfusion.org/free/el/rpmfusion-free-release-8.noarch.rpm https://download1.rpmfusion.org/nonfree/el/rpmfusion-nonfree-release-8.noarch.rpm
Press y to proceed with the installation.
Step 3: Install SDL2 Library Dependencies
FFMpeg will require the use of the SDL2 library. You can install it using YUM, issue the following command:
# yum install http://rpmfind.net/linux/epel/7/x86_64/Packages/s/SDL2-2.0.14-2.el7.x86_64.rpm
Step 4: Install FFMpeg
Now install the ffmpeg package using the yum command:
# yum install ffmpeg ffmpeg-devel
Press y to proceed the installation.
Step 5: Verify install of FFMpeg
If everything worked as expected, you should be able to see the installed version. Try one of the two commands, and you should see similar output on successful install.
# rpm -qi ffmpeg
# ffmpeg -version
Step 6: FFMPEG Audio and Video file conversion:
When converting audio and video files using 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 webm to mp4:
# ffmpeg -i input.webm output.mp4
Convert an audio file from mp3 to ogg:
# ffmpeg -i input.mp3 output.ogg
You can specify the codecs you want to use with the -c option. The codec can be the 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
We have shown you how to install FFmpeg on CentOS 8 machines. For more detail please visit the official FFmpeg Documentat.