How to Install and Use FFmpeg on CentOS 7. FFmpeg is a great tool to record, convert and stream audio and video.

This tutorial covers the steps required to install FFmpeg on CentOS. We will use the ffmpeg command line tool to convert audio, add text to video and many more.

Not using CentOS 7? Choose a different OS:

This tutorial is tested on Google Cloud for automatic image and video processing.

Prerequisites

A CentOS 7 system or server with sudo privileges.

If you are using Google Cloud you need to have some additional requirements fulfilled.

Install FFmpeg on CentOS

As FFmpeg is not available in CentOS 7 core repositories you need to install it using yum from Nux Dextop repository.

01. Start by updating the packages and install the EPEL software repository.

sudo yum update
sudo yum install epel-release

02. Import the Nux Dextop GPG key to your CentOS system.

sudo rpm --import http://li.nux.ro/download/nux/RPM-GPG-KEY-nux.ro 

Install Nux Dextop repositories.

sudo rpm -Uvh http://li.nux.ro/download/nux/dextop/el7/x86_64/nux-dextop-release-0-5.el7.nux.noarch.rpm

02. Once done, you can proceed to install FFmpeg.

sudo yum install ffmpeg ffmpeg-devel

03. Verify the installation.

ffmpeg -version

The output will be something similar to this.

Output
ffmpeg version 2.8.15 Copyright (c) 2000-2018 the FFmpeg developers built with gcc 4.8.5 (GCC) 20150623 (Red Hat 4.8.5-28)

Now, FFmpeg is installed successfully and ready to be used.

FFmpeg Examples

In this part, we will look at some basic examples to use the ffmpeg utility.

Basic conversion

While converting the audio and the video files with ffmpeg you don’t need to specify the input and output formats. The input file format is detected automatically and the output format is selected from the file extension.

Convert a video file from webm to mp4

ffmpeg -i input.webm output.mp4

Convert an audio file from ogg to mp3

ffmpeg input.ogg output.mp3

Specifying codecs

You can also specify the codecs you want to use with the -c flag option. The codec can be the name of any supported decoder/encoder or a special value copy which simply copies the input stream.

Convert a video file from webm to mp4 using the libvpx video codec and libvorbis audio codec

ffmpeg -i input.webm -c:v libvpx -c:a libvorbis output.mp4

Convert an audio file from ogg to mp3 encoded with the libopus codec.

ffmpeg -i input.ogg -c:a libopus output.mp3

Conclusion

Now you have learned how to install FFmpeg on your CentOS system.

Thanks for your time. If you face any problem or any feedback, just leave a comment below.

Write A Comment

This site is protected by reCAPTCHA and the Google Privacy Policy and Terms of Service apply.

Where Writing Meets Entrepreneurship!

Get FREE Google Cloud Tutorials.
GET NOW
close-link
Please help us get 1000 likes in Facebook. Thank You!
LIKE NOW

Stay Connected!

Get latest tutorials on Google Cloud and Open Source topics
SUBSCRIBE
close-link