Quantcast
Channel: has an internet? » Installing Shit
Viewing all articles
Browse latest Browse all 8

cPanel/WHM 11.38 ffmpeg install

$
0
0

Well, it’s time to re-write the rules again. The latest releases of cPanel/WHM have changed the game in a lot of ways, so it’s about time for a re-written guide. This will guide you through installing the latest version of ffmpeg on a cPanel server, along with a number of required libraries. The last update to this post was July 1, 2013.

Some Prerequisites

There are a few things you’ll need to prepare if you’re on a fresh installation.

  1. Subversion and some libraries
  2. Subversion is required to download and install ffmpeg and mplayer. We also need to make sure you’ve got a bunch of libraries for all the crap we’re going to custom-compile, so we might as well get that out of the way first.

    yum install subversion libXext libXext-devel libcurl libcurl-devel curl curl-devel zlib-devel openssl-devel gettext-devel expat-devel

  3. Git
  4. Git is required because for some reason, when you install mplayer, it forces you to download a Git repository of ffmpeg. Don’t use this repository for installing ffmpeg – it breaks with a strange error message. How you install Git will vary across OSes.
    cd /usr/local/src
    wget https://git-core.googlecode.com/files/git-1.8.3.2.tar.gz
    tar -zxf git-1.8.3.2.tar.gz
    cd git-1.8.3.2
    make prefix=/usr/local all
    make prefix=/usr/local install

  5. Ruby
  6. Ruby is required for flvtool. You can install this using the cPanel script:

    /scripts/installruby

    If you're not using cPanel, you can probably install this using your package manager.

  7. faac
  8. faac doesn't compile any more, so we're going to install the rpmforge RPM for it instead.

    rpm -ivh http://pkgs.repoforge.org/faac/faac-1.26-1.el5.rf.x86_64.rpm http://pkgs.repoforge.org/faac/faac-devel-1.26-1.el5.rf.x86_64.rpm

    If you're not on a CentOS 5.x 64-bit install, check http://pkgs.repoforge.org/faac/ for the package you want.

  9. libxvid
  10. The source code for libxvid doesn't compile properly on CentOS in a way that lets it be used as a shared package, so we're going to install the rpmforge RPM for it instead.

    rpm -ivh http://pkgs.repoforge.org/xvidcore/xvidcore-1.2.2-1.el5.rf.x86_64.rpm http://pkgs.repoforge.org/xvidcore/xvidcore-devel-1.2.2-1.el5.rf.x86_64.rpm

    If you're not on a CentOS 5.x 64-bit install, check http://pkgs.repoforge.org/xvidcore/ for the package you want.

  11. ldconfig
  12. To make sure mplayer and ffmpeg install using the correct libs, we need to make sure ld knows where to find our libraries. First, check:

    nano /etc/ld.so.conf

    Make sure that this file contains the line:

    /usr/local/lib

    If you're on a 64-bit system you should also add:

    /usr/local/lib64

    Save (CTRL+O), exit (CTRL+W), and then update:

    ldconfig

    If you run in to any "file not found" errors, it's probably ldconfig.

  13. Remove any other installations
  14. You might already have ffmpeg installed. If it was compiled in, that's fine, this will overwrite it. But if you have RPM binaries installed, this will cause issues. Run the following:

    rpm -qa | grep ffmpeg
    rpm -qa | grep mplayer
    rpm -qa | grep mencoder

    Remove with rpm -e any libraries, common files, or binary installations of these packages to prevent conflicts.

Download All The Things

One note; the official distribution release of ffmpeg-php no longer compiles. Someone forked it and is maintaining a git repository here: https://github.com/tony2001/ffmpeg-php so this is the version we will use for ffmpeg.

  1. Let's get started! This step can and probably should be copy/pasted into your terminal all in one block.

  2. cd /usr/local/src
    wget http://rubyforge.org/frs/download.php/17497/flvtool2-1.0.6.tgz
    tar zxf flvtool2-1.0.6.tgz
    wget http://iweb.dl.sourceforge.net/project/lame/lame/3.99/lame-3.99.5.tar.gz
    tar zxf lame-3.99.5.tar.gz
    git clone https://github.com/tony2001/ffmpeg-php.git ffmpeg-php
    wget http://downloads.xiph.org/releases/vorbis/libvorbis-1.3.3.tar.gz
    tar xzf libvorbis-1.3.3.tar.gz
    wget http://downloads.xiph.org/releases/ogg/libogg-1.3.1.tar.gz
    tar xzf libogg-1.3.1.tar.gz
    wget http://iweb.dl.sourceforge.net/project/opencore-amr/opencore-amr/opencore-amr-0.1.3.tar.gz
    tar xzf opencore-amr-0.1.3.tar.gz
    wget http://downloads.xiph.org/releases/theora/libtheora-1.1.1.tar.bz2
    tar xjf libtheora-1.1.1.tar.bz2
    wget http://downloads.sourceforge.net/faac/faad2-2.7.tar.gz
    tar zxf faad2-2.7.tar.gz
    wget http://www.tortall.net/projects/yasm/releases/yasm-1.2.0.tar.gz
    tar zxf yasm-1.2.0.tar.gz
    mkdir /usr/local/lib/codecs
    wget ftp://ftp.mplayerhq.hu/MPlayer/releases/codecs/essential-20071007.tar.bz2
    tar xjf essential-20071007.tar.bz2
    svn co svn://svn.code.sf.net/p/gpac/code/trunk/gpac gpac
    git clone git://git.videolan.org/x264.git
    cp /usr/local/src/essential-20071007/* /usr/local/lib/codecs/
    chmod -R 755 /usr/local/lib/codecs/
    mkdir /usr/local/src/tmp
    chmod 777 /usr/local/src/tmp
    export TMPDIR=/usr/local/src/tmp

  3. Now it's time to grab mplayer and ffmpeg, the latest versions possible.

  4. git clone git://source.ffmpeg.org/ffmpeg.git ffmpeg
    svn checkout svn://svn.mplayerhq.hu/mplayer/trunk mplayer

Let's Compile This Shit!

Alright, now we're down to the good stuff - compilation! Hopefully if the above steps went correctly this will just fly by. However I do not recommend that you copy and paste the entire command tree into the terminal at this point. Run everything one step at a time to catch any errors if they do occur. Google is your friend, but feel free to leave a comment here if you run in to any problems.

  1. Lame

  2. cd /usr/local/src/lame-3.99.5/
    ./configure
    make
    make install

  3. Libogg

  4. cd /usr/local/src/libogg-1.3.1
    ./configure
    make
    make install

  5. Libvorbis

  6. cd /usr/local/src/libvorbis-1.3.3
    ./configure
    make
    make install

  7. yasm

  8. cd /usr/local/src/yasm-1.2.0
    ./configure
    make
    make install

  9. Libx264

  10. cd /usr/local/src/x264
    ./configure --enable-shared
    make
    make install

  11. Flvtool

  12. cd /usr/local/src/flvtool2-1.0.6
    ruby setup.rb config
    ruby setup.rb setup
    ruby setup.rb install

  13. Opencore-amr

  14. cd /usr/local/src/opencore-amr-0.1.3
    ./configure
    make
    make install

  15. Libtheora

  16. cd /usr/local/src/libtheora-1.1.1
    ./configure
    make
    make install

  17. faad2

  18. cd /usr/local/src/faad2-2.7
    ./configure
    make
    make install

  19. MP4Box

  20. cd /usr/local/src/gpac
    ./configure
    make
    make install

  21. Mplayer - remember, this will download a new version of ffmpeg for some crazy reason. When it asks, just hit enter and allow it to download. It's only used for compiling mplayer.

  22. cd /usr/local/src/mplayer/
    ./configure --enable-jpeg
    make
    make install

  23. FFMpeg

  24. cd /usr/local/src/ffmpeg
    ./configure --enable-libmp3lame --enable-libvorbis --enable-shared --enable-libopencore-amrnb --enable-libopencore-amrwb --enable-nonfree --enable-libtheora --enable-version3 --enable-gpl --enable-libxvid
    make
    make install

  25. ffmpeg-php

  26. cd /usr/local/src/ffmpeg-php
    phpize
    ./configure
    make
    make install

  27. php.ini - All that's left is to modify your php.ini file! Add the following near the top of the file /usr/local/lib/php.ini (to avoid conflicts)

  28. extension=ffmpeg.so

  29. Restart Apache
  30. /etc/init.d/httpd restart

That's It!

At this point you should have a fully functional ffmpeg installation compiled in to PHP. You can test this with the following:


php -m | grep ffmpeg

You should get the output:

ffmpeg

Thank you very much to serverhostingsecrets.com for providing a very stable base for me to build this tutorial on!


Viewing all articles
Browse latest Browse all 8

Latest Images

Trending Articles





Latest Images