How to Install FFmpeg on a shared Server ” Dreamhost”

September 16, 2008

Submitted by: Fahdos

Category: Web & Design

5,866 views

Some of you, probably, will or want to create a video website like YouTube (YoutTube clone). To be able to do so you’re going to need ffmpeg, lame, libvorbis and other programs installed on your server. Today, I’ll explain how to install them easily.
There are two methods to do it, the dirty one and the easy (very easy) one. I’ll start with the dirty one:

How to manually install ffmpeg, lame, libogg, libvorbis…

This is exactly how I did it last year  (how we did it :D cos Fay helped me)  :P
First of all, you have to login to your server using SSH as the owner account of your directory, and because I’m not a Linux user I used Putty (http://www.putty.org)

Putty fahdos

Create these directories, and set their correct permissions

$ mkdir bin lib tmp
$ chmod 777 tmp
$ chmod 775 bin lib

mkdir: creates the directory
chmod: sets the correct permissions for the directory

Export these variables

$ export TMPDIR=$HOME/tmp
$ export PATH=$HOME/bin:$PATH
$ export LD_LIBRARY_PATH=$HOME/lib:/usr/local/lib:$LD_LIBRARY_PATH
$ export CPATH=$HOME/include:/usr/local/include:$CPATH
$ export LIBRARY_PATH=$HOME/lib:/usr/local/lib:$LIBRARY_PATH
$ mkdir src
$ cd src

Autoconf

$ wget http://ftp.gnu.org/gnu/autoconf/autoconf-2.63.tar.gz
$ tar -zxf autoconf-2.63.tar.gz
$ cd autoconf-2.63
$ ./configure --prefix=$HOME
$ make && make install
$ cd ..

LAME:

$ wget http://nchc.dl.sourceforge.net/sourceforge/lame/lame-398.tar.gz
$ tar -zxvf lame-398.tar.gz
$ cd lame-398
$ ./configure "--prefix=$HOME" "--enable-shared"
$ make && make install
$ cd..

Libogg

$ wget http://downloads.xiph.org/releases/ogg/libogg-1.1.3.tar.gz
$ tar -zxf libogg-1.1.3.tar.gz
$ cd libogg-1.1.3
$ ./configure --prefix=$HOME
$ make && make install
$ cd ..

Libvorbis

$ wget http://downloads.xiph.org/releases/vorbis/libvorbis-1.2.0.tar.gz
$ tar -zxf libvorbis-1.2.0.tar.gz
$ cd libvorbis-1.2.0
$ ./configure --prefix=$HOME
$ make && make install
$ cd ..

Mplayer:

$ wget http://www3.mplayerhq.hu/MPlayer/releases/codecs/essential-20061022.tar.bz2
$ bunzip2 essential-20061022.tar.bz2
$ tar -xf essential-20061022.tar
$ mv essential-20061022 $HOME/lib
$ wget http://www3.mplayerhq.hu/MPlayer/releases/MPlayer-1.0rc1.tar.bz2
$ bunzip2 MPlayer-1.0rc1.tar.bz2
$ tar -xf MPlayer-1.0rc1.tar
$ cd MPlayer-1.0rc1
$ ./configure --prefix=$HOME --with-codecsdir=$HOME/lib/essential-20061022/
$ make && make install
$ cd ..

Amr

$ wget http://ftp.penguin.cz/pub/users/utx/amr/amrnb-7.0.0.0.tar.bz2
$ wget http://ftp.penguin.cz/pub/users/utx/amr/amrwb-7.0.0.2.tar.bz2
$ gunzip  amrnb-7.0.0.0.tar.bz2
$ gunzip  amrwb-7.0.0.2.tar.bz2
$ tar xvf  amrnb-7.0.0.0.tar
$ tar xvf  amrwb-7.0.0.2.tar
$ cd amrnb-7.0.0.0
$ ./configure --prefix=$HOME
$ make && make install
$ cd ..
$ cd amrwb-7.0.0.2
$ ./configure --prefix=$HOME
$ make && make install
$ cd ..

FFmpeg

$ svn checkout svn://svn.mplayerhq.hu/ffmpeg/trunk ffmpeg
$ cd ffmpeg
$ ./configure --prefix=$HOME --cross-compile --enable-shared --enable-libmp3lame --enable-libamr-nb --enable-libamr-wb --extra-cflags=-I$HOME/include --extra-ldflags=-L$HOME/lib
$ make && make install
$ cd..

Test :
Now you can test to convert for exemple an AVI file to flv.
Here is the command I use to generate FLVs:

$ /path/to/ffmpeg -i /path/to/inputfile.avi -acodec mp3 -ab 32 -ac 1 -ar 44100 /path/to/outputfile.flv

Exemple :

$ bin/ffmpeg -i www/videos/test.avi test.flv

Cooool, It works
But there’s still one problem; after restarting your server you’ll get this error while trying to do the test again

[fahdos]$ bin/ffmpeg -i www/test2.avi www/test2.flv
bin/ffmpeg: error while loading shared libraries: libavformat.so.51: cannot open shared object file: No such file or directory

The solution is quite simple

Login with SSH again and tape:

$ vi .bash_profile
i

Then past these lines:

export TMPDIR=$HOME/tmp
export PATH=$HOME/bin:$PATH
export LD_LIBRARY_PATH=$HOME/lib:/usr/local/lib:$LD_LIBRARY_PATH
export CPATH=$HOME/include:/usr/local/include:$CPATH
export LIBRARY_PATH=$HOME/lib:/usr/local/lib:$LIBRARY_PATH

Tape the Esc key then tape

:wq

Restart your server and test it again, now it will work

How to Automatically install ffmpeg, lame, libogg, libvorbis…

We will use The ffmpeginstall Script for the shared server:
This series of scripts will install all required modules for running video streaming application websites in a shared environment. A number of webhosts provides large amount of disk space and normal shell access to your Linux server. So now you can setup your own ffmpeg environment in a shared account.
To do so, just visit www.ffmpeg.sherin.in
It will install all you need with just few clicks. Documentation
NB: the website maybe down, so please download the file from :

  Automatic Installation (11.8 KiB, 819 hits)


For instruction, open the INSTALL File.

Have Fun :D

If you liked this, please share it at your favorite sites:
  • Digg
  • Reddit
  • del.icio.us
  • Wikio
  • Facebook
  • Google
  • Technorati
  • TwitThis
  • MySpace
  • N4G
  • NewsVine
  • StumbleUpon
  • BlogMemes
  • Blogsvine
  • blogtercimlap
  • DotNetKicks
  • eKudos
  • Faves
  • Fleck
  • Scoopeo
  • Socialogs
  • Upnews
  • Yigg
  • E-mail this story to a friend!
  • Mixx

29 Responses :D Pretty Cool

  • so you call my help a “dirty” one :\
    ok Dos, 3qel fiha, remind it next time when you will ask Fay another help :P

  • lol :p

  • Great walkthrough, got it working on my Dreamhost account no problems! Many thanks for taking the time to share this :)

    Spotted a couple of typos in your guide - when installing AMR your guide mentions gunzip, rather than bunzip2. I also had to install the LibOGG libraries before the LibVorbis ones.

  • @Andrew Gatenby:
    Sorry dude, it was just a mistake. ( i’m talking about Libogg and libvorbis )
    thanks :p

  • Скажите, где найти хозяина agafix.org.

    С меня пыво)
    ———
    Ответы на любые вопросы

  • @Интересные факты
    all of us are owners of agafix.org

  • OK I AM having trouble installing this fucking script/software whatever the fuck you wanna call it.

    To make things easier i decided to go with the AUTOMATIC installation. I got this .tar file and now i dont know what to do with it. there are no instructions on how to install it either.

    can anyone please help me? Thanks =]

  • djpazze@yahoo.com

    Please i need help.

    xtrigit@yahoo.com

    djpazze@live.com

    please!!!

  • got though the whole thing until the FFMpeg config

    changed to:
    ./configure –prefix=$HOME –enable-cross-compile –enable-shared –enable-nonfree –enable-libmp3lame –enable-libamr-nb –enable-libamr-wb –extra-cflags=-I$HOME/include –extra-ldflags=-L$HOME/lib

    seems like it worked :)

    Thanks!

  • Thanks for this manual.
    Although for the ffmpeg install (on Dreamhost) I had to use the following:

    ./configure –prefix=$HOME –enable-cross-compile –enable-nonfree –enable-shared –enable-libmp3lame –enable-libamr-nb –enable-libamr-wb –extra-cflags=-I$HOME/include –extra-ldflags=-L$HOME/lib

  • 8) 8) hello all my problem is

    HOME/libnb –enable-libamr-wb –extra-cflags=-I$HOME/include –extra-ldflags=-L$
    libamr is nonfree and –enable-nonfree is not specified.
    If you think configure made a mistake, make sure you are using the latest
    version from SVN. If the latest version fails, report the problem to the
    ffmpeg-user@mplayerhq.hu mailing list or IRC #ffmpeg on irc.freenode.net.
    Include the log file “config.err” produced by configure as this will help
    solving the problem.
    [thing]$

    plss help

  • hey guys, can you help with installation for shared hosting. i need instructions that link expired i guess

  • @Max: Done

  • Documentation link is not working… Any other suggestions besides google?

  • hey.

    Im not a noob, but I am a noob at server installs.

    Anyone wana help me out here with a little bit better details on how to use the automatic install.

    I unzipped it and got inside a folder and opened INSTALL. Now im lost :P DO I download something else? whats the # tar -xyzf thing?

  • Upload the compressed file to your server, and log in using SSH, then tape:
    tar -xvzf sharedhostffmpeg.1.0.tar.gz
    cd sharedhostffmpeg.1.0/
    …….

  • It worked so good, but now I’m a little confused about where to place the .bash_profile file.

    Somebody knows?…thanks

  • Just leave it where it is ;)

  • thanks for sharing dude

  • Thanks ma8 the auto-installer is working great, at the install ending I come here to post the results… :up:

  • I’m having some problems with phpize on the ffmpeg-php, but It seems like it’s a problem from my php installation, I’m trying to fix, the rest worked.

  • Have to do all by myself, the auto-installer didn’t work. It’s all broken…

  • Looking at the changelog for ffmpeg, it appears libamr was removed from the build sometime december 07; therefore, to get this going, you have to use a older build by using: `svn checkout –revision 15624 svn://svn.ffmpeg.org/ffmpeg/trunk ffmpeg-15624` and then `./configure –prefix=$HOME –enable-cross-compile –enable-shared –enable-libmp3lame –enable-nonfree –enable-amr-nb –enable-amr-wb –extra-cflags=-I$HOME/include –extra-ldflags=-L$HOME/lib` should work fine..

  • Thanks Mate, I didn’t noticed that libamr was out of the releases. But now Dreamhost just gave me full root access via SUDO command to my Private Server and it’s a lot easier now.

    Seeya

  • Ya no problem, I wish i knew ahead of time that Dreamhost could give me sudo access, but it is all well.. at least for now.

  • Hi

    Automatic Installation is not avalaible.

    Can you update the link ??

    Thank you !

  • sorry for the delay :( , you can now download the file. :evil:

  • Latest site for downloads and information on automatic installation is here…

    http://sourceforge.net/projects/shf/files/

  • Hello Fahdos can you please help me install this ffmpeg in my server?
    We can talk in skype my skype is labelnine, I try so hard but still nothing I can do to install ffmpeg in my server…. Please please help me!!!

Leave a Reply

:D :) :cry: :( 8O :twisted: :!: :vangry: :XO: :up: ;) :mrgreen: :halo: :kiss: :roll: :? 8) :evil: :oops: :| :?: :x :$: