In this article, we want to teach you how to Install and Use FFmpeg on Centos 7.
FFmpeg is a free software project that produces libraries and programs for handling and manipulating multimedia data. FFmpeg can handle the entire process of transcoding, video and image manipulation (resizing, denoising, etc.), packaging, streaming, and playback. It is the most popular video and image processing software by a mile and is used by many companies across various industries.
How To Install and Use FFmpeg on Centos 7
Before you start to install FFmpeg on Centos 7, you need to log in to your server as a non-root user with sudo privileges. To do this, you can follow our article about the Initial Server Setup with Centos 7.
Now let’s see how to install FFmpeg on your server.
Installing FFmpeg on Centos 7
FFmpeg packages aren’t available in the default Centos repository. Here you will install it from the RPM Fusion repository.
First, update your local package index with the following command:
sudo yum update
Then, you need to install the Epel repository on Centos 7 with the following command:
sudo yum install epel-release
Now you can enable the RPM Fusion repository with the following command:
sudo yum localinstall --nogpgcheck https://download1.rpmfusion.org/free/el/rpmfusion-free-release-7.noarch.rpm
When the repository is enabled, install FFmpeg with the following command:
sudo yum install ffmpeg ffmpeg-devel
You can verify your installation by checking its version:
In your output you will see:
Output ffmpeg version 3.4.9 Copyright (c) 2000-2021 the FFmpeg developers built with gcc 4.8.5 (GCC) 20150623 (Red Hat 4.8.5-44)
Now that you have FFmpeg installed on your Centos 7, you can start using it.
At this point, we will show you how to use FFmpeg on Centos 7 with some basic examples.
You don’t have to specify the input and output formats when you are converting the audio and video files with FFmpeg on Centos 7.
The input file format is auto-detected, and the output format is guessed from the file extension.
For example, to convert a video file from mp4 to webm you can use the following command:
ffmpeg -i input.mp4 output.webm
And to convert an audio file from mp3 to ogg you can use the following command:
ffmpeg -i input.mp3 output.ogg
Also, you can use the –c parameter to specify the codecs when you are converting the files.
For example, you can convert a video file from mp4 to webm using the libvpx video codec and the libvorbis audio codec:
ffmpeg -i input.mp4 -c:v libvpx -c:a libvorbis output.webm
And to convert an audio file mp3 to ogg encoded with the libopus codec, you can use the following command:
ffmpeg -i input.mp3 -c:a libopus output.ogg
For more details and information about the FFmpeg, you can visit the official FFmpeg documentation page.
FFmpeg is a great library to have in your video processing and compression toolbox. FFmpeg has endless capabilities and being open-source, you are more than welcome to modify the source and extend its capabilities.
At this point, you learn to install and use FFmpeg on Centos 7.
Hope you enjoy it.
May you will be interested in these articles: