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 ffmpeg
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.
- A running Compute Engine, see the Setting up Compute Engine Instance with CentOS 7.
- Initial CentOS 7 Server Set up.
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 ffmpeg
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 -c
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.