ServerTune cPanel and DirectAdmin LicensingServer Management PlansVirtual Private ServersDedicated Servers
Line HomeAbout ServerTuneContact usTechnical SupportKBResellersSpecial Promotions
Space
Login |
Space
Accessing ServerTune's Knowledgebase

Serious about business? check this out:

Issues, Tips, and Solutions
Space
Search:    Advanced search
Browse by category:
| Glossary |
HowTo :: FFmpeg and FFpeg-Php
Printer Friendly
email to a friend
Add comment Add comment
Views: 1876
Votes: 1
Comments: 0
Posted: 15 Jul, 2007
by: Support T.
* * * * *
Updated: 11 Apr, 2008
by: Support T.

FFmpeg is a complete solution to record, convert and stream audio and video. It includes libavcodec, the leading audio/video codec library.

NOTE:
If you experience any problems installing FFmpeg on your server and need help, we suggest you sign up for the Xpress Plan. Our Linux certified engineers are ready to fix any problem you might have with your server.

To install FFmpeg on your server, SSH to the server and run the commands below (in that order).

  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/local/codecs/
    • mv essential-20061022/* /usr/local/local/codecs/
    • chmod -R 755 /usr/local/local/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
      If configure compile fails, you need to edit the 'configure' file to point to a different tempdir. Create that directory in /home/ffmpeg/tmp Then edit the configure file and find:
        if test ! -z "$TMPDIR" ; then
            TMPDIR1="$"
        elif test ! -z "$TEMPDIR" ; then
            TMPDIR1="$"
        else
            TMPDIR1="/tmp"
        fi

        Change to

        if test ! -z "$TMPDIR" ; then
            TMPDIR1="$"
        elif test ! -z "$TEMPDIR" ; then
            TMPDIR1="$"
        else
            TMPDIR1="/home/ffmpeg/tmp"
        fi

      • 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=ffmpeg.so' >> /usr/local/local/php.ini
  16. Restart Apache to load FFmpeg-Php (Depends on OS, this is for RHEL/CentOS)
    • /sbin/service httpd restart
  17. Verify if FFmpeg 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

      That means FFMPEG, FFMPEG-PHP, MPlayer, MEncoder, flv2tool, LAME MP3 encoder & libOGG are working on your system.
Other articles in this Category
document HowTo: Tweak php for maximum execution time for scripts
document Call to unsupported or undefined function mysql_connect
document Php scripts returning errors when using: php_flag and php_value
document FFmpeg :: headers not found. Make sure you've built ffmpeg as shared libs
document Fatal error: Allowed memory size of 22468 bytes exhausted (tried to allocate 446810 bytes) in /path/file.php
document FFmpeg :: libamrnb.so.2: cannot open shared object file: No such file or directory
document HowTo secure your vBulletin Forum



RSS