FFmpeg installation

Here is my note for installation of FFmpeg. FFmpeg is mostly used to covert original video and audio to another format.

Here is the steps for the installation.

  1. Install codec libraries you want
  2. Install FFmpeg
  3. Install FFmpeg php extension (optional)

1. Install codec libraries you want

You need to install codec libraries you want to use in FFmpeg before installing FFmpeg.
I installed mp3lame(lame mp3 encoder) , amr-nb and amr-wb(Adaptive Multi-Rate audio code).

1-1. Install mp3lame

#cd /usr/local/src
#wget http://jaist.dl.sourceforge.net/sourceforge/lame/lame-3.97.tar.gz
#tar zxvf lame-3.97.tar.gz
#cd lame-3.97
#./configure
#make
#make install

1-2. Install amr-nb

#cd /usr/local/src
#wget http://ftp.penguin.cz/pub/users/utx/amr/amrnb-7.0.0.0.tar.bz2
#tar zxvf amrnb-7.0.0.0.tar.bz2
#cd amrnb-7.0.0.0
#./configure
#make
#make install

1-3. Install amr-wb

#cd /usr/local/src
#wget http://ftp.penguin.cz/pub/users/utx/amr/amrwb-7.0.0.2.tar.bz2
#tar zxvf amrwb-7.0.0.2.tar.bz2
#cd amrwb-7.0.0.2
#./configure
#make
#make install

2. Install FFmpeg

On configuring FFmpeg compilation, you can use many options like –prefix and –enable-mp3lame, which means install directory and to enable MP3 encoding via libmp3lame respectively to use these encoder. Unfortunately, FFmpeg has different options on each version. So, you have to care about the version and check the options the following commands after downloading the source:

#./configure –help

I installed FFmpeg 0.5.2. You can download the recent version and old version here.
The following is the installation of FFmpeg:

#cd /usr/local/src
#wget http://www.ffmpeg.org/releases/ffmpeg-0.5.2.tar.bz2
#cd ffmpeg-0.5.2
#./configure –enable-libmp3lame –enable-libamr-nb –enable-libamr-wb –enable-nonfree –enable-shared
#make
#make install

–enable-nonfree is added because it was said “libamr_nb is nonfree and –enable-nonfree is not specified.”. –enable-shared is added to install FFmpeg php extension later. After installation, if you get a error like “ffmpeg: error while loading shared libraries: libavdevice.so.52: cannot open shared object file: No such file or directory
“, you can put shared library path in /etc/ld.so.conf.

#vi /etc/ld.so.conf
-add the line of “/usr/local/lib”
#ldconfig

Finally, you can check the result of the installation like this and use FFmpeg.

#ffmpeg -version
FFmpeg version 0.5.2, Copyright (c) 2000-2009 Fabrice Bellard, et al.
configuration: –enable-libmp3lame –enable-libamr-nb –enable-libamr-wb –enable-shared –enable-nonfree
libavutil 49.15. 0 / 49.15. 0
libavcodec 52.20. 1 / 52.20. 1
libavformat 52.31. 0 / 52.31. 0
libavdevice 52. 1. 0 / 52. 1. 0
built on Aug 22 2010 18:09:14, gcc: 4.1.2 20080704 (Red Hat 4.1.2-48)
FFmpeg 0.5.2
libavutil 49.15. 0 / 49.15. 0
libavcodec 52.20. 1 / 52.20. 1
libavformat 52.31. 0 / 52.31. 0
libavdevice 52. 1. 0 / 52. 1. 0

3. Install FFmpeg php extension (optional)

This is very simple like the following:

#cd /usr/local/src
#wget https://sourceforge.net/projects/ffmpeg-php/files/ffmpeg-php/0.6.0/ffmpeg-php-0.6.0.tbz2/download
#cd ffmpeg-php-0.6.0
#phpize
#./configure
#make
#make install

After the installation, you have to relate the module to php in the way like this.

#vi /etc/php.d/ffmpeg.ini
-add the line of “extension=ffmpeg.so”
#/etc/rc.d/init.d/httpd reload

The easy way to test FFmpeg php extension is to use test_ffmpeg.php, which shows FFmpeg information.

#cd /usr/local/src/ffmpeg-php-0.6.0
#php test_ffmpeg.php

That is all. Now, you can enjoy FFmpeg. Good luck!

Links(Japanese):
http://i43z.com/ffmpeg-mplayer-mencoder-windows/build-install-library-for-ffmpeg
http://hero-kick.com/linux/entry-111.html
http://www.cgis.biz/others/ffmpeg/
http://aerith.mydns.jp/regrets/2007/11/ffmpeg-install.html
http://htffmpegx.seesaa.net/article/9194572.html
Links(English):
http://www.eukhost.com/forums/f15/how-install-ffmpeg-ffmpeg-php-mplayer-mencoder-flv2tool-lame-mp3-encoder-4893/

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s