How to Compile and Install FFmpeg from source in CentOS/RHEL?

I got an ERROR: ffprobe or avprobe not found while installing youtube-dl command-line utility on CentOS. This tutorial will show you on how to compile and install FFmpeg from source with few library support. The ffprobe command comes with FFmpeg package.

Download FFmpeg:

$ git clone git://source.ffmpeg.org/ffmpeg.git ffmpeg
Cloning into 'ffmpeg'...
remote: Counting objects: 465630, done.
remote: Compressing objects: 100% (95977/95977), done.
remote: Total 465630 (delta 372075), reused 462103 (delta 368886)
Receiving objects: 100% (465630/465630), 76.45 MiB | 5.48 MiB/s, done.
Resolving deltas: 100% (372075/372075), done.
$ cd ffmpeg/
$ ./configure --help

install ffmpeg linux

Note: Lookout for various options and decide what library support you may need to enable or disable:

These are the few modules you may require:

  • Yasm
  • libmp3lame
  • libx264
  • libx265
  • libfdk_aac
  • libopus
  • libogg
  • libvorbis
  • libvpx

But I’ll install only few:

Install Yasm:

$ git clone --depth 1 git://github.com/yasm/yasm.git
Cloning into 'yasm'...
remote: Counting objects: 1622, done.
remote: Compressing objects: 100% (1238/1238), done.
remote: Total 1622 (delta 262), reused 1172 (delta 168), pack-reused 0
Receiving objects: 100% (1622/1622), 1.44 MiB | 502 KiB/s, done.
Resolving deltas: 100% (262/262), done.
$ autoreconf -fiv
$ ./configure
$ make
$ sudo make install

Install libmp3lame:

$ wget http://downloads.sourceforge.net/project/lame/lame/3.99/lame-3.99.5.tar.gz
$ cd lame-3.99.5/
$./configure
$ make
$ sudo make install

Install libx264:

$ git clone --depth 1 git://git.videolan.org/x264
Cloning into 'x264'...
remote: Counting objects: 250, done.
remote: Compressing objects: 100% (249/249), done.
remote: Total 250 (delta 44), reused 39 (delta 0)
Receiving objects: 100% (250/250), 943.85 KiB | 452 KiB/s, done.
Resolving deltas: 100% (44/44), done.
$ cd x264
$ ./configure
$ make
$ sudo make install

Install libogg:

$ wget http://downloads.xiph.org/releases/ogg/libogg-1.3.2.tar.gz
$ tar xvzf libogg-1.3.2.tar.gz
$ cd libogg-1.3.2/
$ ./configure
$ make
$ sudo make

Install libvorbis:

$ wget http://downloads.xiph.org/releases/vorbis/libvorbis-1.3.4.tar.gz
$ tar xvzf libvorbis-1.3.4.tar.gz
$ cd libvorbis-1.3.4/
$ ./configure
$ make
$ sudo make install

Compile and Install FFmpeg from source:

$ ./configure --enable-libmp3lame --enable-libvorbis  --enable-gpl --enable-libx264
$ make
$ sudo make install
:::::::::::::::::::::::::::::
INSTALL libavutil/timecode.h
INSTALL libavutil/timestamp.h
INSTALL libavutil/tree.h
INSTALL libavutil/twofish.h
INSTALL libavutil/version.h
INSTALL libavutil/xtea.h
INSTALL libavutil/tea.h
INSTALL libavutil/lzo.h
INSTALL libavutil/avconfig.h
INSTALL libavutil/ffversion.h
INSTALL libavutil/libavutil.pc

Note: Make sure to enable or disable libraries in ./configure command.

Check if ffprobe command is working properly:

$ ffprobe -version
ffprobe version N-78637-g7586b3a Copyright (c) 2007-2016 the FFmpeg developers
built with gcc 4.1.2 (GCC) 20080704 (Red Hat 4.1.2-55)
configuration: --disable-yasm
libavutil 55. 18.100 / 55. 18.100
libavcodec 57. 24.105 / 57. 24.105
libavformat 57. 26.100 / 57. 26.100
libavdevice 57. 0.101 / 57. 0.101
libavfilter 6. 35.100 / 6. 35.100
libswscale 4. 0.100 / 4. 0.100
libswresample 2. 0.101 / 2. 0.101

Note: You may need to set LD_LIBRARY_PATH to ensure all the necessary libraries are in path as shown in this tutorial.

Updated on September 2, 2017

Was this article helpful?

Related Articles

Leave a Comment