Installing FFMPEG on Linux

FFMPEG is an open source application that allows you to convert video and audio files easily between a variety of different formats. It supports most industry-standard codec and can convert from one file format to another quickly and easily. This article will guide you to installing FFMPEG and other codec on Linux.

FFMPEG Installation Requirements:

  • LAME Mp3 Audio Codec (Requred for mpg, flv, avi, wmv etc files)
  • AMR Audio Codec (Required for 3gp video files)
  • XVID Audio Codec

Note on installing FFMPEG:

  • All the Audio Codec getting used in FFMPEG are not part of FFMPEG Source base

Converting Audios Videos Using FFMPEG

FFMPEG Download URL:
On the download page of FFMPEG they have geven the download link from SVN and checkout-snapshot but i would suggest to use SVN source code base.
The url for the SVN source code for FFMPEG is: svn://

To download from SVN you will have to install subversion located at, or you can use “TortoiseSVN” located at

LAME Mp3 Codec download URL: Lame Mp3 Codec

Executing FFMPEG Command from PHP Applications

AMR Audio Download URL: AMR Audio Codec
To install the AMR codec you will require both AMR-WB and AMR-NB files.

XVID Audio Download URL: XVID Audio Codec


Installation Steps:
It is a good practice to install all the external audio codec libraries first and then install the FFMPEG.

Installing LAME MP3 Encoder

  • Untar the lame file by using tar zxvf lametarfile
  • Assign 777 permission rights to the lame folder by typing chmod 777 lamefolder -R
  • Traverse to the root of lame folder and type
    make install

Extract Video Thumbnail from FFMPEG

Installing AMR Codec
For installing the AMR codec there are two separate files that needs to be installed are AMR-WB and AMR-NB.

  • Untar the AMR file by using tar zxvf tarfile
  • Assign 777 permission rights to the amr folder by typing chmod 777 amrfolder -R
  • Traverse to the root of amr folder and type
    make install

Note on Installing AMR:
You might get errors installing AMR codec on Autoconf utility of linux. To resolve this problem will have to install the latest version of Autoconf utility from Download AutoConf

Installing Xvid Codec

  • Untar the xvid file bu using tar zxvf tarfilename
  • Assign 777 permission rights to the lame folder by typing chmod 777 xvidfolder -R
  • Traverse to the root of xvid folder
  • Goto Build/generic folder and type
    make install

Installing GCC

  • This is required only if the SVN for FFMPEG is not compatible with the existing version of GCC(3x) requires a new version for the same
  • After the installation of GCC need to convert all the files of SVN to Unix compatible by using “dos2unix ffmpegfolder/* -R”.

Installing FFMPEG

  • Download the ffmpeg from SVN
  • Assign 777 permission rights to the ffmpeg folder by typing chmod 777 ffmepgfolder -R
  • Traverse to the root of ffmpeg folder and type
    ./configure –enable-libmp3lame –enable-libogg –enable-libvorbis –enable-libamr-nb –enable-libamr-wb –enable-libxvid –enable-gpl –enable-shared
    make install


Installing FFMPEG-PHP

  • Download the ffmpeg-php from Sourceforge
  • Unpack the archive by using following command “tar -xjf ffmpeg-php.X.XX.tar.gz”
  • Iterate inside the ffmpeg-php directory
  • Run phpize (included with your php install) to build configuration files
    make install

If you are planning to install FFMPEG-PHP then will have to add –enable-shared parameter while configuring FFMPEG

You might get installation error while making the file related to html or texti files in ffmpeg\doc folder. The solution for this that worked for me is to just create a empty file by using touch command in the respective folders.

The following configure parameter will work with FFMPEG 0.49. But now the latest version does not have –enable-libogg parameter so if you are planning to installing the latest version then the configure parameter would be /configure –enable-libmp3lame –enable-libvorbis –enable-libamr-nb –enable-libamr-wb –enable-libxvid –enable-gpl –enable-shared.

Note on Reinstalling FFMPEG:
If you are planning to reinstall the FFMPEG software the will have to perform following steps:

  • ./configure –enable-libmp3lame –enable-libogg –enable-libvorbis –enable-libamr-nb –enable-libamr-wb –enable-libxvid –enable-gpl –enable-shared
  • make clean
  • make
  • make install

Lot of people are facing error on loading shared libraries, solution to the same is:
export LD_LIBRARY_PATH=/usr/local/lib/

Still facing problem while installing leave a comment, will try my best to help you out. :)

Related Articles:

About Hitesh Agrawal

Wait... checking
Tagged . Bookmark the permalink.

84 Responses to Installing FFMPEG on Linux

  1. Paresh says:

    Hello Hitesh,
    I have successfully installed LAME, AMR(both version), XVD, now have started with FFMPEG.
    I have checkout the code, changed the permission, Traverse to the root of ffmpeg folder and finally typed

    ./configure –enable-libmp3lame –enable-libogg –enable-libvorbis –enable-libamr-nb –enable-libamr-wb –enable-libxvid –enable-gpl –enable-shared

    but am getting following error,
    Unknown option “–enable-libmp3lame”.

    though i have installed the LAME.

    Could you please tell what additinal things i have to do?

    Thanx in advance for guidance.

  2. Paresh says:

    Hey Neveo, this is regarding ur comment/post number 36.

    am also facing the same problem,
    Unknown option “–enable-libmp3lame”.

    Did you find out any solution?

  3. Ashish says:

    Hi Hitesh,

    I want to install vhook in ffmpeg. Is there any way to enable vhook capabilities in ffmpeg.
    Also I want to install imlib2. Please can you help me, how can I do it.


  4. Daniel says:

    Hey Hitesh,

    I’m currently trying to install FFmpeg on my centos 5.3 server. When i run it to see if it’s working i get the error

    “ffmpeg: error while loading shared libraries: cannot open shared object file, or some other library. ”

    I don’t know anything about linux however so i have not been able to follow along with previous posts. If it’s not a lot to it, could you please tell me step by step, what commands i need to type through the terminal?

    Thanks a lot!

  5. Jorge says:

    Hi, Hitesh.

    I need your help with the installation of ffmpeg-php.
    i have ffmpeg installed. that is the config.
    FFmpeg version SVN-r19082, Copyright (c) 2000-2009 Fabrice Bellard, et al.
    configuration: –prefix=/home/ehrspain/executable –enable-gpl –enable-nonfree –enable-postproc –enable-avfilter –enable-avfilter-lavf –enable-pthreads –enable-x11grab –enable-bzlib –enable-libamr-nb –enable-libamr-wb –enable-libfaac –enable-libfaad –enable-libfaadbin –enable-libmp3lame –enable-libtheora –enable-libvorbis –enable-libxvid –enable-zlib
    libavutil 50. 3. 0 / 50. 3. 0
    libavcodec 52.30. 2 / 52.30. 2
    libavformat 52.34. 0 / 52.34. 0
    libavdevice 52. 2. 0 / 52. 2. 0
    libavfilter 0. 5. 0 / 0. 5. 0
    libswscale 0. 7. 1 / 0. 7. 1
    libpostproc 51. 2. 0 / 51. 2. 0
    built on Jun 4 2009 13:39:09, gcc: 4.1.2 20061115 (prerelease) (Debian 4.1.1-21)
    At least one output file must be specified

    when i try to install ffmpeg-php.0.6.0 with the follow steps.
    % phpize
    % ./configure –with-ffmpeg=/home/ehrspain/executable
    % make
    % make test

    the last command show me these errors.

    /home/ehrspain/executable/bin/php: symbol lookup error: /home/ehrspain/executable/lib/php/extensions/no-debug-non-zts-20060613/ undefined symbol: avcodec_build
    make: [test] Error 127 (ignored)

    My web is under service. the ffmpeg under line command run good. but i need the ffmpeg-php.
    any ideas ?

    thanks for your help.

  6. Moiz says:

    Dude need some help with ffmpeg-php

    Everything installed well with ffmpeg, libmp3lame and stuff… now when i do the make for ffmpeg-php i get this error

    /home/moiz/ffmpeg-php- In function ‘_php_convert_frame’:
    /home/moiz/ffmpeg-php- warning: implicit declaration of function ‘img_convert’
    /home/moiz/ffmpeg-php- In function ‘_php_crop_frame’:
    /home/moiz/ffmpeg-php- warning: implicit declaration of function ‘img_copy’
    /home/moiz/ffmpeg-php- In function ‘_php_resample_frame’:
    /home/moiz/ffmpeg-php- error: ‘ImgReSampleContext’ undeclared (first use in this function)
    /home/moiz/ffmpeg-php- error: (Each undeclared identifier is reported only once
    /home/moiz/ffmpeg-php- error: for each function it appears in.)
    /home/moiz/ffmpeg-php- error: ‘img_resample_ctx’ undeclared (first use in this function)
    /home/moiz/ffmpeg-php- warning: implicit declaration of function ‘img_resample_full_init’
    /home/moiz/ffmpeg-php- warning: implicit declaration of function ‘img_resample’
    /home/moiz/ffmpeg-php- warning: implicit declaration of function ‘img_resample_close’
    /home/moiz/ffmpeg-php- In function ‘zif_toGDImage’:
    /home/moiz/ffmpeg-php- error: ‘PIX_FMT_RGBA32′ undeclared (first use in this function)
    /home/moiz/ffmpeg-php- In function ‘zif_ffmpeg_frame’:
    /home/moiz/ffmpeg-php- error: ‘PIX_FMT_RGBA32′ undeclared (first use in this function)

    plz help me out

  7. Moiz says:

    Sorry for the above post … i think i got it working. The latest build of ffmpeg-php had the PIX format fixed.

    thanks anyway

  8. shital says:

    Hi all,

    I have tried to install amrweb (amrwb- and amrnb (amrnb- on Ubuntu. But i got this error : configure: error: You need patch utility to prepare sources.

    I am trying to convert avi , mpg and wav files into flv but not getting voice (sound).

    Please help me out to solve it asap.

  9. Sudhakara Rao says:

    I am new for linux server, we need to install ffmpeg and other codec on it. in install perl module i found ffmpeg module which to be install. but i didn’t find other codec files which you said above. How can i install them through WHM only. server details cPanel 11.24.5-R37453 – WHM 11.24.2 – X 3.9
    CENTOS 5.3 i686
    The hostgator people asking $75 to install it.

    Please help me..

  10. Nitin Iyer says:

    I downloaded all the files as mentioned above in the article. I uploaded all of them to a folder on the same level as that of the public_html folder. All files were successfully untared. Then I followed each step as mentioned above. But I still get the error Unknown –enable-libamr-nb. Can any body tell me if the source files are to be placed in any particular folder? Im running all the commands as Root.

  11. Munish says:

    Hi Hitesh,

    i have done with all the things it worked fine but the only problem is that the audio is getting so much of noise. even i used the parameter -absf noise and chnaged the parameters but with no success i appreciate if you pls let me know what would be the best configuration audio parameters for linux.

    Best Regards’
    Munish Dogra

  12. Pingback: PianoFan

  13. utsavi says:


    i have installed ffmpeg successfully.

    # php -i | grep ffmpeg
    ffmpeg-php version => 0.6.0-svn
    ffmpeg-php built on => Nov 24 2009 18:42:08
    ffmpeg-php gd support => enabled
    ffmpeg libavcodec version => Lavc52.20.0
    ffmpeg libavformat version => Lavf52.31.0
    ffmpeg swscaler version => SwS0.7.1
    ffmpeg.allow_persistent => 0 => 0
    ffmpeg.show_warnings => 0 => 0

    also add the extention=\\ in php.ini file.

    extension_dir = \/usr/lib/php/modules\

    extension is loaded and i have checked ffmpeg entry in phpinfo.php file

    when i used ffmpeg in my php script like below,

    $encode_cmd = \$audioffmpeg -i notify.wav test.mp3\;
    exec($encode_cmd) or die (\ffmpeg did not work\);

    it shows me \ffmpeg did not work\

    in usr/bin directory there is a entry of ffmpeg so i have used ‘usr/bin/ffmpeg’ path. Also i have check in usr/local/bin but there is no any single file

    i dont know it is path problem or other.

    how would i check n set the exact path in php script?
    how would i use ffmpeg in my php script?


  14. xiejin says:

    Hello .@shital

    You need to install patch !

    Like this :
    yum install patch

    —-good luck ~~

  15. Sayan Acharjee says:

    I was trying to install ffmpeg-php on Fedora9, I’ve downloaded the ffpmeg-php-0.6.0 and used phpize and ./configure –enable-shared –prefix=/usr and both of them worked fine but when I tried to run make I got the following error:
    “make: *** No targets specified and no makefile found. Stop.”

    I tried the same procedure with ffmpeg-php-0.5.1 and ffmpeg-0.5.0 but failed.
    Can anyone help with this. :|

  16. KJ says:

    Got this error loading shared libraries while using it with Apache.

    How can i solve it as i created an application with web interface which converts the videos. If i convert it from command line it works like champ but if i try to convert from my browser then it gives error \loading shared libraries cannot open shared object file: No such file or directory\

    Any Idea.

    Thanks In Advance

  17. Pingback: libavutil

  18. Pingback: Extracting audio from video

  19. faruk says:

    I have tries to install ffmpeg but it says -enable version3 is not supported.

    libopencore_amrnb is version3 and –enable-version3 is not specified.

  20. Vivekanand Mishra says:

    Thanks dude.. It helped lot to me.. Finally i got success with help of this article. hurrayy…

  21. Jason Guan says:

    hi, I have installed patch on my linux, but there is no vhook installed.


  22. Shahzad says:

    I got stuck at FFMPEG configuration. I am getting this error

    Unknown option “–enable-libogg”.
    See ./configure –help for available options.

    Can anyone help me?

    • Hi Shahzad,
      If you do not require ogg file conversion in your FFMPEG than just remove this option from configure. Otherwise you will have to go through list of options available in “./configure -help” and check for ogg options.

      Hitesh Agarwal

  23. rajesh says:

    i have installed ffmpeg0.6.1.tar.gz and i have not installed any other packages like lamemp3 andxvid codec .i am facing problem while getting audio file from video .i am installing it on guest folder and i have no root privileges.can u tell me the steps for installing total ffmpeg with all packages and with a player

  24. Dionysius says:


    This problem could you fix, wenn your ffmpeg command works in SSH, but not in PHP with exec for example.

    First, look everytime at your servers error_log.

    if you have: ffmpeg: error while loading shared libraries: cannot open shared object file: No such file or directory

    put in your php file which uses ffmpeg:
    @putenv(“LD_LIBRARY_PATH=/usr/local/lib”); // change to your path used by ffmpeg

    you can find out that path by using “printenv” in SSH

    Maybe there’s a way to put that in php.ini?

  25. Nitin ray says:

    thanks for this post i really appreciate your work.

  26. David says:

    I am currently developing on a Mac, and dont have access to linux, but need linux static builds(not-shared) for 32 and 64bit machines as I plan to acces FFMPEG via Java. Is there any site with pre-compiled builds that exists?

  27. Imran says:

    This is really a cool tutorial. Keep it up.

  28. hi hitesh

    I want to install vhook in ffmpeg.
    Is there any way to enable vhook capabilities in ffmpeg.
    can you plz help me ?

  29. Pingback: José Arrarte | Audio y video en Java utilizando ffmpeg, Jffmpeg, y JMF | José Arrarte

Leave a Reply

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

You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>