FFMPEG is a major multimedia framework, able to decode, encode, transcode, mux, demux, stream, filter and play various audio and video files in different formats. FFMPEG is a very fast video and audio converter that can also grab from a live audio/video source. It can also convert between arbitrary sample rates and re-size video on the fly with a high quality polyphase filter. It is supported by various library files like libavcodec, libavutil, libavformat, libavfilter, libavdevice, libswscale and libswresample.
libavcodec - an audio/video codec library
libavutil - utility library to aid portable multimedia programming
libavformat - library which provides framework for multiplexing and multiplexing video/audio and subtitle streams
libavfilter - library which enhances a generic audio/video filtering
libavdevice - library which provides a framework grabbing from and rendering to many common multimedia input/output devices framework
libswscale - library enhancing highly optimized image scaling and colorspace and pixel format conversion operations
libswresample - library promoting audio resampling, rematrixing and sample format conversion operations
In short, it is a free software available with libraries and programs to handle multimedia data. It can also be used as a command line tool in PHP and other programming languages for transcoding multimedia files.
In this tutorial, we learn how to install FFMPEG on CentOS 7. You can simply install FFMPEG using yum or choose to install from source.
Installation Steps for FFMPEG on CentOS 7
We need to install a suitable repo file that includes this FFMPEG package which is the most important step of this installation.
1. Enable RPM Fusion repo
It is a third-party RPM repository that contains many popular multimedia related packages for CentOS releases. This repo works only if the EPEL repo is enabled in the server.
First make sure that you've enabled EPEL repo. To enable EPEL repo on a CentOS 7 server, type:
$ sudo yum -y install epel-release
Now, enable RPM Fusion repo:
$ sudo yum localinstall --nogpgcheck https://download1.rpmfusion.org/free/el/rpmfusion-free-release-7.noarch.rpm
Verify RPM Fusion repository is installed successfully by:
$ sudo yum repolist
2. Install FFMPEG and FFMPEG devel packages
To install FFMPEG and its development packages, type:
$ sudo yum -y install ffmpeg ffmpeg-devel
3. Verify FFMPEG
Verify ffmpeg installation by check FFMPEG version.
$ sudo ffmpeg
ffmpeg version 3.4.8 Copyright (c) 2000-2020 the FFmpeg developers built with gcc 4.8.5 (GCC) 20150623 (Red Hat 4.8.5-39)
Now we have completed the installation of ffmpeg version 3.4.8.
Now lets check how to use FFMPGE with an example.
Lets convert a mp3 file to oog format using this module on CLI.
Download an mp3 file and execute the ffmpeg command to convert the mp3 file to ogg format.
$ sudo wget https://ia802508.us.archive.org/5/items/testmp3testfile/mpthreetest.mp3
$ sudo ffmpeg -i mpthreetest.mp3 -c:a libvorbis -q:a 4 mpthreetest.ogg
Now our MP3 test file is converted to Vorbis (ogg) audio compression format which is much better compared to mp3.
Similarly, we can encode, decode and convert any video, images or audio file formats using this command-line tool. We can even make use this module in PHP by proper coding. You can get more information on using this tool by referring to the manual page which you can get by running the command "man ffmpeg".
$ man ffmpeg
I hope you enjoyed reading this documentation on FFMPEG. I would recommend your valuable suggestions and comments on this!
Have a Nice Day :)