How to Install and Use FFmpeg on CentOS 8.

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. 

The tools

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 on CentOS 8
FFmpeg on CentOS 8

# 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

Specifying codecs:

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

Conclusion:

We have shown you how to install FFmpeg on CentOS 8 machines. For more detail please visit the official FFmpeg Documentat.

Sajid Ali
Linux & Windows Server Administrator | Cloud Architect: I possess 10 years of professional experience with administration of different hosting provider’s Linux and Windows based servers on a large production level.

LEAVE A REPLY

Please enter your comment!
Please enter your name here

Latest articles

You might also likeRELATED

How to migrate from CentOS 8 to CentOS Stream Server:

Before 2021, CentOS was regarded as an enterprise-stable, production-ready operating system that had been cloned from Red Hat Enterprise Linux. It had a few...

How to migrate from CentOS 8 to Rocky Linux.

Rocky Linux is a Linux distribution that is intended to be a downstream, complete binary-compatible release using the Red Hat Enterprise Linux operating system...

How to Install Jitsi Meet on Ubuntu 20.04:

In this article you will learn how to install Jitsi Meet on Ubuntu 20.04. Jitsi Meet is a fully encrypted open source JavaScript WebRTC application...