October 10, 2008

How to setup an encoding/streaming server

Notice: **Do not apply those commands without thinking! **There are many ways to Rome, therefore many ways to get ffmpeg + codecs to be setup correctly! This is one way I came up with, that just works!

Depending on library updates etc.. few things might need to be altered, especially newer librairies and dependencies…

**Pre-requites: **Some gcc and C compiling concept knowledge

Configure the system

A couple of software/tools are required

Install subversion ruby libogg libvorbis libvorbis-devel gcc gcc-c++ make

Now download the needed packages

essential codecs from http://www3.mplayerhq.hu/MPlayer/releases/codecs/ (use whatever codes you might feel like getting or need) Mplayer (use version revision 1 that is proven to work straight with this setup or venture for revision 2) from http://www4.mplayerhq.hu/MPlayer/releases/ FLVtool from http://rubyforge.org/frs/download.php/17497/ LAME from http://easynews.dl.sourceforge.net/sourceforge/lame/

Now untar the packages either using tar -zxf for tar.gz files or tar -jxf for .tar.bz2 (depending on the file compressed extension you downloaded)

— After all packages have been uncompressed, proceed to installation

mkdir /usr/local/lib/codecs

mv essential-VERSION/* /usr/local/lib/codecs (keep in mind, the codecs are up to you)

chmod -Rf 755 /usr/local/lib/codecs/

now get ffmpeg and mplayer from svn

svn checkout svn://svn.mplayerhq.hu/ffmpeg/trunk ffmpeg

svn checkout svn://svn.mplayerhq.hu/mplayer/trunk mplayer

proceed to install lame

cd lame-VERSION

./configure && make && make install

proceed now to install flvtool

cd flvtool-VERSION

ruby setup.rb config

ruby setup.rb setup

ruby setup.rb install

we now to build a set of symlinks (VERY IMPORTANT)

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

now let’s install Mplayer

export LD_LIBRARY_PATH=/usr/local/lib

cd Mplayer-VERSION

./configure

cat configure.log |grep lame (make sure libmp3lame was loaded)

make && make install

and finally FFMPEG (depending on the modules you need, here we only decide to have lame and vorbis)

cd ffmpeg-VERSION

./configure –enable-libmp3lame –enable-libvorbis –disable-mmx

make && make install

echo “/usr/local/lib” >> /etc/ld.so.conf

echo “/usr/lib” >> /etc/ld.so.conf

ldconfig

and voila :-) - good luck!