How to compile FFmpeg on CentOS, Fedora or RHEL

Last updated on October 23, 2020 by Dan Nanni

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.

Build FFmpeg from the 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 source 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

Support Xmodulo

This website is made possible by minimal ads and your gracious donation via PayPal or credit card

Please note that this article is published by Xmodulo.com under a Creative Commons Attribution-ShareAlike 3.0 Unported License. If you would like to use the whole or any part of this article, you need to cite this web page at Xmodulo.com as the original source.

Xmodulo © 2021 ‒ AboutWrite for UsFeed ‒ Powered by DigitalOcean