How to compile FFmpeg on CentOS, Fedora or RHEL

Question: How can I compile and build FFmpeg on CentOS, Fedora or RHEL?

If you want to use FFmpeg on RPM-based Linux, you can install pre-built FFmpeg package by using yum package manager after enabling additional third-party repositories. However, the version of FFmpeg included in such repositories is typically outdated. If you want to try FFmpeg's bleeding edge features, you probably want to build FFmpeg yourself from its source.

Here is how to compile FFmpeg on CentOS, Fedora or RHEL.

On CentOS, enable RPM Fusion and EPEL repositories first. On Fedora, enable RPM Fusion first.

Go ahead and install all the packages required to build FFmpeg as follows. Note that depending on which libraries you want to enable, you may need to install additional packages.

$ sudo yum install gcc-c++ make yasm pkgconfig libXext-devel libXfixes-devel x264-devel zlib-devel

Next, download FFmpeg code, and compile it as follows.

$ wget http://ffmpeg.org/releases/ffmpeg-2.3.3.tar.bz2
$ tar xvfvj ffmpeg-2.3.3.tar.bz2
$ cd ffmpeg-2.3.3
$ ./configure --enable-shared --enable-nonfree --enable-gpl --enable-decoder=aac --enable-libx264 --enable-demuxer=mov --enable-x11grab --enable-zlib --enable-protocol=http --enable-filter=aformat --enable-filter=volume --enable-filter=aresample
$ make

Finally, install FFmpeg on your system.

$ sudo make install

Verify the installation by running ffmpeg command without any option.

Troubleshooting during FFmpeg Installation

1. If you encounter the following error, install yasm package. Note that on CentOS, you first need to set up EPEL repository before.

yasm/nasm not found or too old

Use yum package manager to install the package as follows.

$ sudo yum install yasm

2. If you encounter the error below, install x264 development package. You need to enable RPM Fusion repository first.

ERROR: libx264 not found

Use yum command to install the necessary package as follows.

$ sudo yum install x264-devel

3. If you get the error below, install libXext development package with yum command.

ERROR: Xext not found
$ sudo yum install libXext-devel

4. If you get the error below, install libXfixes development package with yum command.

ERROR: Xfixes not found
$ sudo yum install libXfixes-devel

Subscribe to Ask Xmodulo

Do you want to receive Linux related questions & answers published at Ask Xmodulo? Enter your email address below, and we will deliver our Linux Q&A straight to your email box, for free. Delivery powered by Google Feedburner.

Leave a comment

Your email address will not be published. Required fields are marked *

Current ye@r *