FFmpeg is a popular open-source solution to record, convert, and stream audio and video, which is widely used in all kinds of online streaming services. This guide has been tested on CentOS 6, 7, and 8.
Prerequisites
- Deploy a new Rcs CentOS cloud server instance.
- Create a sudo user.
- Update the system.
CentOS 8
Install the Extra Packages for Enterprise Linux repository.
$ sudo yum install https://dl.fedoraproject.org/pub/epel/epel-release-latest-8.noarch.rpm
$ sudo 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
$ sudo yum install http://rpmfind.net/linux/centos/8-stream/PowerTools/x86_64/os/Packages/SDL2-2.0.10-2.el8.x86_64.rpm
Install the FFmpeg and FFmpeg development packages.
# sudo yum install ffmpeg ffmpeg-devel
CentOS 7
Install the Nux Dextop repository.
$ sudo rpm --import http://li.nux.ro/download/nux/RPM-GPG-KEY-nux.ro
$ sudo rpm -Uvh http://li.nux.ro/download/nux/dextop/el7/x86_64/nux-dextop-release-0-5.el7.nux.noarch.rpm
Install the FFmpeg and FFmpeg development packages.
$ sudo yum install ffmpeg ffmpeg-devel -y
CentOS 6
Install the Nux Dextop repository.
$ sudo rpm --import http://li.nux.ro/download/nux/RPM-GPG-KEY-nux.ro
$ sudo rpm -Uvh http://li.nux.ro/download/nux/dextop/el6/x86_64/nux-dextop-release-0-2.el6.nux.noarch.rpm
Install the FFmpeg and FFmpeg development packages.
$ sudo yum install ffmpeg ffmpeg-devel -y
Test the Installation
Confirm the installation of FFmpeg:
$ ffmpeg -version
Example: Convert an MP3 audio file to an OGG audio file.
$ cd
$ wget https://archive.org/download/MLKDream/MLKDream_64kb.mp3
$ ffmpeg -i MLKDream_64kb.mp3 -c:a libvorbis -q:a 4 MLKDream_64kb.ogg
Example: Convert an MP4 video file to an OGG video file.
$ cd
$ wget https://archive.org/30/items/I_Have_A_Dream_Speech_excerpt/I_Have_A_Dream_Speech_excerpt.mpeg4 -O MLKDream.mpeg4
$ ffmpeg -i MLKDream.mpeg4 -codec:v libtheora -qscale:v 3 -codec:a libvorbis -qscale:a 3 -f ogv MLKDream.ogv