Installing Ffmpeg on Linux
For Asset Bank to be able to create thumbnails and previews for video and audio files Asset Bank uses Ffmpeg (http://ffmpeg.mplayerhq.hu).
The following instuctions explain how to install Ffmpeg and required libraries from source (and so they require a compiler such as gcc). Please note:
- The required libs will be installed into /usr/local (/usr/local/lib; /usr/local/bin etc). Ffmpeg will be installed into /usr/local/bin
- These instructions may need to be varied for different versions of Linux. We have also provided specific instructions for Debian GNU/Linux Squeeze (6.0) and Lenny (5.0) which we recommend that you use if you are running Debian
- You may not need to install the libraries and programs that ffmpeg needs (lame, libx264, libvorbis, libtheora, libspeex and yasm) from source - you may be able to install using your package manager. For example, on Debian you can install them using app-get install libmp3lame-dev libvorbis-dev libtheora-dev libx264-dev libspeex-dev yasm. You may need to edit /etc/apt/sources.list to add add:
deb http://debian-multimedia.org/ squeeze main non-free
1. Configure the Library Search Path
Because you will be installing libraries into /usr/local/lib you need to make sure that the dynamic linker (ld.so) looks in /usr/local/lib when it is searching for libraries. Some distributions include /usr/ local/lib in the dynamic library search path by default but some do not (notably Red Hat).
View /etc/ld.so.conf using "more" or "less". If it already contains the line "/usr/local/lib" then the library search path is already OK so please skip to the next section.
If /etc/ld.so.conf contains the line "include ld.so.conf.d/*.conf" then create a file called /etc/ld.so.conf.d/local.conf containing the line "/usr/local/lib". If you are installing on a 64-bit version of Linux ("uname -m" command returns "x86_64") then add another line containing "/usr/local/lib64" as well. If /etc/ld.so.conf does NOT contain the line "include ld.so.conf.d/*.conf" then add these lines to the end of /etc/ld.so.conf instead of creating a seperate /etc/ ld.so.conf.d/local.conf file.
Run "/sbin/ldconfig" as root. This command updates the dynamic linker's cache of library locations. You should also run this command after installing libraries.
2. Install Lame
- 2.1) Download the tar file. Get the latest version from http://lame.sourceforge.net/download.php
- 2.2) Untar the installation files: tar xf lame-x.y.tar
- 2.3) Move into the installation directory then build, configure and install:
cd lame-x.y
./configure --prefix=/usr/local
make
sudo make install
3. Install libbogg, libvorbis, libtheora and libspeex
- 3.1) Download libvorbis, libtheora, libspeex and libbogg from http://xiph.org/downloads/, and compile and install them.
4. Install yasm
- 3.1) Download yasm from http://yasm.tortall.net/Download.html and compile and install it.
5. Install 264
- 3.1) Download x264 from http://www.videolan.org/developers/x264.html configure with these options "./configure --libdir=/usr/local/lib --includedir=/usr/local/include/ --enable-shared --prefix=/usr" and compile and install it.
6. Install Ffmpeg
- 6.1) Download and extract the ffmpeg source code:
mkdir software
cd software
wget http://ffmpeg.org/releases/ffmpeg-0.8.3.tar.bz2
cd ..
mkdir src
cd src
tar xvjf ../software/ffmpeg-0.8.3.tar.bz2 - 6.2) Move into the source directory: cd ffmpeg-0.8.3
- 6.3) If you have installed the required libs from source and have problems linking, make sure /usr/lib is in the search path. For example, set the library path: export LD_LIBRARY_PATH=/usr/lib
- 6.4) Configure, build and install:
./configure --enable-gpl --enable-postproc --enable-swscale --enable-avfilter --enable-libmp3lame --enable-libvorbis --enable-libtheora --enable-libx264 --enable-libspeex --enable-shared --enable-pthreads
make
sudo make install - 6.5) Run "/sbin/ldconfig" as root.
Notes:
- In the past it has sometimes been necessary to set the LD_LIBRARY_PATH variable to allow ffmpeg to find the libraries it requires. If ffmpeg fails with errors like "error while loading shared libraries: libfaac.so.0: cannot open shared object file: No such file or directory" then you can try setting LD_LIBRARY_PATH. This can be done by adding export LD_LIBRARY_PATH=/usr/lib to the file setenv.sh in [tomcat]/bin