Installing FFMPEG – The easy way!

Need help installing FFMPEG on your server or shared account? Let our experienced technicians help you at NO COST, for free, sign up today and post on our online community for help: FFMPEG Help Forums

Good News: Customers of VEXXHOST Web Hosting can now automatically install PHPmotion and VidiScript instantly from cPanel, they do not need to do any ffmpeg configuration or ffmpeg installation, they simply enter a username and a password and the software will be ready and online in seconds.

A lot of people are getting hiring people to install FFMPEG as they think it’s a difficult task, but it’s much easier than you think if you follow these instructions. You should have root access & basic Linux knowledge to the server to follow these instructions.

1. Create a directory to do our work in
mkdir ~/ffmpeg
cd ~/ffmpeg

2. Get all the source files
wget http://www3.mplayerhq.hu/MPlayer/releases/codecs/ essential-20061022.tar.bz2
wget http://rubyforge.org/frs/download.php/9225/ flvtool2_1.0.5_rc6.tgz
wget http://easynews.dl.sourceforge.net/sourceforge/ lame/lame-3.97.tar.gz
wget http://superb-west.dl.sourceforge.net/sourceforge/ ffmpeg-php/ffmpeg-php-0.5.0.tbz2
wget http://downloads.xiph.org/releases/ ogg/libogg-1.1.3.tar.gz
wget http://downloads.xiph.org/releases/ vorbis/libvorbis-1.1.2.tar.gz

3. Extract all the source files
bunzip2 essential-20061022.tar.bz2; tar xvf essential-20061022.tar
tar zxvf flvtool2_1.0.5_rc6.tgz
tar zxvf lame-3.97.tar.gz
bunzip2 ffmpeg-php-0.5.0.tbz2; tar xvf ffmpeg-php-0.5.0.tar
tar zxvf libogg-1.1.3.tar.gz
tar zxvf libvorbis-1.1.2.tar.gz

4. Create the codecs directory & import them
mkdir /usr/local/lib/codecs/
mv essential-20061022/* /usr/local/lib/codecs/
chmod -R 755 /usr/local/lib/codecs/

5. Install SVN/Ruby (Depends on OS, this is for RHEL/CentOS)
yum install subversion
yum install ruby
yum install ncurses-devel

6. Get the latest FFMPEG/MPlayer from the subversion
svn checkout svn://svn.mplayerhq.hu/ffmpeg/trunk ffmpeg
svn checkout svn://svn.mplayerhq.hu/mplayer/trunk mplayer

7. Compile LAME
cd ~/ffmpeg/lame-3.97
./configure
make
make install

8. Compile libOGG
cd ~/ffmpeg/libogg-1.1.3
./configure
make
make install

9. Compile libVorbis
cd ~/ffmpeg/libvorbis-1.1.2
./configure
make
make install

10. Compile flvtool2
cd ~/ffmpeg/flvtool2_1.0.5_rc6
ruby setup.rb config
ruby setup.rb setup
ruby setup.rb install

11. Compile MPlayer
cd ~/ffmpeg/mplayer
./configure
make
make install

12. Compile FFMPEG
cd ~/ffmpeg/ffmpeg
./configure --enable-libmp3lame --enable-libogg --enable-libvorbis --disable-mmx --enable-shared
echo '#define HAVE_LRINTF 1' >> config.h
make
make install

13. Finalize the codec setups
ln -s /usr/local/lib/libavformat.so.50 /usr/lib/libavformat.so.50
ln -s /usr/local/lib/libavcodec.so.51 /usr/lib/libavcodec.so.51
ln -s /usr/local/lib/libavutil.so.49 /usr/lib/libavutil.so.49
ln -s /usr/local/lib/libmp3lame.so.0 /usr/lib/libmp3lame.so.0
ln -s /usr/local/lib/libavformat.so.51 /usr/lib/libavformat.so.51

14. Compile FFMPEG-PHP
cd ~/ffmpeg/ ffmpeg-php-0.5.0
phpize
./configure
make
make install

15. Install FFMPEG-PHP (make sure the php.ini path is correct.)
echo 'extension=/usr/local/lib/php/extensions/ no-debug-non-zts-20020429/ffmpeg.so' >> /usr/local/Zend/etc/php.ini

16. Restart Apache to load FFMPEG-PHP (Depends on OS, this is for RHEL/CentOS)
service httpd restart

17. Verify if it works
php -r 'phpinfo();' | grep ffmpeg

If you get a few lines such as
ffmpeg
ffmpeg support (ffmpeg-php) => enabled
ffmpeg-php version => 0.5.0
ffmpeg.allow_persistent => 0 => 0

Then everything is installed and working. FFMPEG, FFMPEG-PHP, MPlayer, MEncoder, flv2tool, LAME MP3 encoder & libOGG.

  • Pingback: magnum blog » Blog Archive » links for 2008-05-29

  • Hamilcar

    How to install a specific user, is how?

  • usha

    Im getting an error while configuring libogg-1.1.3 , saying
    configure: error: C++ preprocessor “/lib/cpp” fails sanity check
    can anyone please help.

  • uuRcm

    Hi everyone…
    i did everything well from begin to
    cd ~/ffmpeg/ ffmpeg-php-0.5.0
    phpize
    ./configure
    when i try ./configure command, it gives this error..
    checking for ffmpeg headers… configure: error: ffmpeg headers not found. Make sure you’ve built ffmpeg as shared libs using the –enable-shared option

    i searched on Google about it. i found this.
    ./configure –prefix=/usr
    but when i try this command, it gives the same error…
    i’ve build FFMPEG shared….

    Notice: i can’t speak english well.. sorry. :(

  • uuRcm

    I Solve this problem.. but i have an other error :S
    my php.ini file is located in /etc/php.ini
    when i installed ffmpeg i saw my extension dir is = /usr/lib/php/modules/

    now… i’ve added
    extension=ffmpeg.so this line then i’ve restarted httpd…
    when i tried this command: php -r ‘phpinfo();’ | grep ffmpeg

    it gives this error
    PHP Warning: PHP Startup: Unable to load dynamic library ‘/usr/lib/php/modules/ffmpeg.so’ – /usr/lib/php/modules/ffmpeg.so: undefined symbol: av_free_static in Unknown on line 0

  • Moiz

    getting an error after all the isntallations whn trying to convert a file :
    ffmpeg: symbol lookup error: /usr/lib/libavformat.so.52: undefined symbol: av_strlcatf

    cant make head or tails of this

  • Gaurav

    how to install ffmpeg in wamp ?

  • Dani

    I have the same error here…

    [root@demo html]# vi /usr/lib/php/modules/ffmpeg.so
    [root@demo html]# php -r ‘phpinfo();’ | grep ffmpeg
    PHP Warning: PHP Startup: Unable to load dynamic library ‘/usr/lib/php/modules/ffmpeg.so’ – /usr/lib/php/modules/ffmpeg.so: undefined symbol: av_free_static in Unknown on line 0
    [root@demo html]#

    Any ideas ?

  • Dani
  • nagaraju.kasula

    I Need code for converting a given MPEG (Video) file in to a FLV while uploading to my web application.
    Can you give me some idea about it.

  • http://needforvideos.com Serega

    Who can help me to reinstalling ffmpeg and ffmpeg-php latest versions? (i will pay for the work when its done) email me if some one can do it fast (topshaft@nana10.co.il)

  • Bcai

    For the error:

    ffmpeg headers not found

    it’s probably a compatibility issue. I tried use ffmpeg-php verion 0.5.31 (latest one), and it installed

  • Bcai

    sorry it didn’t exactly work, because the latest trunk of ffmpeg as of now doesn’t work with ffmpeg-php verion 0.5.31. so I checked out ffmpeg r15006 and now everything is working as expected

  • http://www.bounceweb.com.br Bounceweb

    For those who are having problem with the tmp dir, follow this steps:

    mkdir ~/tmp/
    chmod 755 ~/tmp/
    export TMPDIR=~/tmp

    done :)

  • http://www.unaalta.org Mihai

    nagaraju.kasula – you can always use exec not necessarily convert from the php library

    something like:
    exec(“ffmpeg -y -i $file -f flv -s widthxheight $flv”);

  • Pingback: Does anyone know a cheap unlimited bandwidth VPS hosting?

  • Alex

    I had error like many others:
    unknown option “–enable-libogg”.

    Then i just run again:

    cd /usr/local/src/libogg-1.1.3
    ./configure
    make && make install

    and its works!

  • akiles

    Thanks for sharing ur knowledge:)

  • http://www.unp.edu.py Juan Pablo

    I’ve followed the instructions word for word, and everything is installed fine. However when I do the verification: php -r ‘phpinfo();’ | grep ffmpeg I get the following response:

    root@server01 [~/ffmpeg/ffmpeg-php-0.5.0]# php -r ‘phpinfo();’ | grep ffmpeg
    OLDPWD => /root/ffmpeg
    PWD => /root/ffmpeg/ffmpeg-php-0.5.0
    _SERVER[”OLDPWD”] => /root/ffmpeg
    _SERVER[”PWD”] => /root/ffmpeg/ffmpeg-php-0.5.0
    _ENV[”OLDPWD”] => /root/ffmpeg
    _ENV[”PWD”] => /root/ffmpeg/ffmpeg-php-0.5.0

    In the web page example1.php

    ← Back to examples list

    This example shows you how to convert video to flash video (flv).
    • The media player used below is Jeroen Wijering’s excellent Flash Media Player. Although bundled with this package the Flash Media Player has a Creative Commons Attribution-Noncommercial-Share Alike 2.0 Generic license.
    • The media player is embedded using PluginObject to embed the examples. It is distributed under a BSD License.

    Please note that this example requires demo files. If you have not got these demo files you can download them from here.

    Processing MOV00007.3gp

    Warning: unlink(/var/www/apache2-default/video/examples/tmp/1228369658-49376efa8a229-multipass-0.log) [function.unlink]: No such file or directory in /var/www/apache2-default/video/phpvideotoolkit.php5.php on line 2597
    FFMPEG ERROR: Execute error. Output for file “/var/www/apache2-default/video/examples/to-be-processed/MOV00007.3gp” was not found. Please check server write permissions and/or available codecs compiled with FFmpeg. You can check the encode decode availability by inspecting the output array from PHPVideoToolkit::getFFmpegInfo().

    Processing Video000.3gp

    Warning: unlink(/var/www/apache2-default/video/examples/tmp/1228369658-49376efa98d30-multipass-0.log) [function.unlink]: No such file or directory in /var/www/apache2-default/video/phpvideotoolkit.php5.php on line 2597
    FFMPEG ERROR: Execute error. Output for file “/var/www/apache2-default/video/examples/to-be-processed/Video000.3gp” was not found. Please check server write permissions and/or available codecs compiled with FFmpeg. You can check the encode decode availability by inspecting the output array from PHPVideoToolkit::getFFmpegInfo().

    Processing cat.mpeg

    Warning: unlink(/var/www/apache2-default/video/examples/tmp/1228369658-49376efaa59a3-multipass-0.log) [function.unlink]: No such file or directory in /var/www/apache2-default/video/phpvideotoolkit.php5.php on line 2597
    FFMPEG ERROR: Execute error. Output for file “/var/www/apache2-default/video/examples/to-be-processed/cat.mpeg” was not found. Please check server write permissions and/or available codecs compiled with FFmpeg. You can check the encode decode availability by inspecting the output array from PHPVideoToolkit::getFFmpegInfo().

    The total time taken to process all 3 file(s) is : 0
    The average time taken to process each file is : 0

    Any Idea????, the /var/www is in 0777 mode

    Please help me!!!!

  • http://www.enil.biz Anil Jeeyani

    solution for those who are facing below prob

    *** Could not run Ogg test program, checking why…
    *** The test program compiled, but did not run. This usually means
    *** that the run-time linker is not finding Ogg or finding the wrong
    *** version of Ogg. If it is not finding Ogg, you’ll need to set your
    *** LD_LIBRARY_PATH environment variable, or edit /etc/ld.so.conf to point
    *** to the installed location Also, make sure you have run ldconfig if that
    *** is required on your system
    ***
    *** If you have an old version installed, it is best to remove it, although
    *** you may also be able to get things to work by modifying LD_LIBRARY_PATH
    configure: error: must have Ogg installed!

    ———————-

    just open /etc/profile file and put below line

    export LD_LIBRARY_PATH=/usr/local/lib

    save and exit

    source /etc/profile

    then do ./configure for libvorbis

    PROBLEM IS LD_LIBRARY_PATH IS NOT SET
    all LIBOGG files are in usr local lib folder
    so just set it

    cheers !!!

  • http://filmcritics.in Tamil movies reviews songs and downloads

    I was also to hire a person from Digital point for my FFMPEG work to be done. But not after reading this. Thanks.

  • http://xodiakscythe.com Anthony

    hello,
    I’m a newbie and I saw every instructions that you have posted, my question is WHERE will I input these commands? I am running my website with siteground, and I need to install ffmpeg but I REALLY don’t know how and where I will input these commands, what do I need to do this? What program do I need sir?What requirements should I have? Please help!!!

  • DJFire

    I have gotten stuck at #10 and can not get passed it… ( Does anyone still read/help on this blog??)

    When I get to this point

    10. Compile flvtool2
    cd ~/ffmpeg/flvtool2_1.0.5_rc6
    ruby setup.rb config
    ruby setup.rb setup
    ruby setup.rb install

    I can go into the folder fine, however, when I type in the command:
    ruby setup.rb config

    I get this error: -bash: ruby: command not found

    Is there another syntax that can be used other than ruby ?

  • Joe

    Thanks a bunch. This is absolutely the best guide for installing ffmpeg and related software. I followed the instructions and were able to installed every thing on a SuSE 11.0 box.

    However, should I be concerned about the following failed tests when doing a “make test” in ffmpeg-php:

    Number of tests : 29 21
    Tests skipped : 8 ( 27.6%) ——–
    Tests warned : 0 ( 0.0%) ( 0.0%)
    Tests failed : 21 ( 72.4%) (100.0%)
    Tests passed : 0 ( 0.0%) ( 0.0%)
    ———————————————————————
    Time taken : 5 seconds
    =====================================================================

    =====================================================================
    FAILED TEST SUMMARY
    ———————————————————————
    ffmpeg getAudioBitRate test [tests/getAudioBitRate.phpt]
    ffmpeg getAudioChannels test [tests/getAudioChannels.phpt]
    ffmpeg getAudioCodec test [tests/getAudioCodec.phpt]
    ffmpeg getAudioSampleRate test [tests/getAudioSampleRate.phpt]
    ffmpeg getAudioStreamId test [tests/getAudioStreamId.phpt]
    ffmpeg getBitRate test [tests/getBitRate.phpt]
    ffmpeg getDuration test [tests/getDuration.phpt]
    ffmpeg getFileName test [tests/getFileName.phpt]
    ffmpeg getFrameCount test [tests/getFrameCount.phpt]
    ffmpeg getFrameHeight test [tests/getFrameHeight.phpt]
    ffmpeg getFrameNumber test [tests/getFrameNumber.phpt]
    ffmpeg getFrameRate test [tests/getFrameRate.phpt]
    ffmpeg getFrameWidth test [tests/getFrameWidth.phpt]
    ffmpeg getID3Info() test [tests/getID3Info.phpt]
    ffmpeg getPixelAspectRatio test [tests/getPixelAspectRatio.phpt]
    ffmpeg getPixelFormat test [tests/getPixelFormat.phpt]
    ffmpeg getVideoBitRate test [tests/getVideoBitRate.phpt]
    ffmpeg getVideoCodec test [tests/getVideoCodec.phpt]
    ffmpeg getVideoStreamId test [tests/getVideoStreamId.phpt]
    ffmpeg hasAudio test [tests/hasAudio.phpt]
    ffmpeg persistent movie test [tests/persistentMovie.phpt]

  • Pingback: Setup Red5 and FFMPEG on Ubuntu 8.04 @ Beier Cai

  • http://zigron.com JayZ

    [root@130 lib]# php -r ‘phpinfo();’ | grep ffmpeg
    PHP Warning: PHP Startup: Unable to load dynamic library ‘/usr/lib/php/modules/ffmpeg.so’ – /usr/lib/php/modules/ffmpeg.so: undefined symbol: img_resample in Unknown on line 0

  • http://zigron.com JayZ

    I have tried all above given fixing steps for this error but no luck

    actually error is little bit different from above on e see the last line of error

    undefined symbol: img_resample in Unknown on line 0

    where can i find this symbol img_resample

  • http://www.lovingexpressions.net Kimi

    hey shane Holloman the command to fix that is
    LD_LIBRARY_PATH=/usr/local/lib export LD_LIBRARY_PATH

  • http://zigron.com JayZ

    Well after a long run i got the solution

    this error means your ffmpeg-php rpm is corrupted so i have just uninstall the previous all rpms of ffmpeg-php.

    step 1
    see how many rpms are there for ffmpeg-php on you system by this comand
    rpm -qa | grep php

    then uninstall the only ones having php-ffmpeg one by one

    rpm -e php-ffmpeg-0.5.1-2.fc8.remi –nodeps

    then WGET new one from here

    http://rpm.pbone.net/index.php3/stat/4/idpl/12277480/com/ffmpeg-php-0.5.1-1.fc7.remi.i386.rpm.html

    rpm -ivh ffmpeg-php-0.5.1-1.fc7.remi.i386.rpm

    install it and it will work fine

  • Pingback: Updated – Setup Red5 and FFMPEG on Ubuntu 8.0.4 @ Beier Cai

  • Pingback: [WTB] ffmpeg & related add-ons installation - Sell - Buy - Trading

  • bsvids

    FFMPEG-PHP instructions need to be updated to:

    wget http://sourceforge.net/projects/ffmpeg-php/files/

  • Myg

    works perfectly:

    if you can't install libogg, use yum or aptget or whatever your OS is using

    If you recieve some permission error disable selinux

  • http://www.balianti.com Shahzad Jameel

    Hi All,

    I got stuck with point #14 when i tried to PHPize.

    PHP was already installed on my server and i am trying to install FFMPEG.

    Can anyone help me quickly? I am getting the following error

    Cannot find config.m4.
    Make sure that you run '/usr/bin/phpize' in the top level source directory of the module

  • http://www.balianti.com Shahzad Jameel

    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?

  • Alex

    i had that problem to :

    checking for pkg-config… yes

    checking for pkg-config… /usr/bin/pkg-config

    checking for ogg >= 1.0… Package ogg was not found in the pkg-config search path.

    Perhaps you should add the directory containing `ogg.pc'

    to the PKG_CONFIG_PATH environment variable

    No package 'ogg' found

    checking for Ogg… no

    *** Could not run Ogg test program, checking why…

    *** The test program compiled, but did not run. This usually means

    *** that the run-time linker is not finding Ogg or finding the wrong

    *** version of Ogg. If it is not finding Ogg, you'll need to set your

    *** LD_LIBRARY_PATH environment variable, or edit /etc/ld.so.conf to point

    *** to the installed location Also, make sure you have run ldconfig if that

    *** is required on your system

    ***

    *** If you have an old version installed, it is best to remove it, although

    *** you may also be able to get things to work by modifying LD_LIBRARY_PATH

    configure: error: must have Ogg installed!

    the solution :
    export PKG_CONFIG_PATH=$PKG_CONFIG_PATH:/usr/local/lib/pkgconfig
    than rerun ./configure and it will work continue with the steps greets

  • prathamesh

    hello could you please show a video tutorial for this.

  • Pingback: Setting up ffmpeg on Windows for PHP | Ben Lynch Blog

  • fadil

    plz proplem install MPlayer

    collect2: ld returned 1 exit status
    make: *** [mplayer] Error 1