Setup ffmpeg and ffmpeg-php on Debian/Ubuntu

Assume you have installed LAMP

1. Prepare your system

apt-get install libjpeg-progs libjpeg62 libjpeg62-dev libsdl1.2-dev php5-dev build-essential unzip1

2. Download package

cd /usr/local/src
wget http://www3.mplayerhq.hu/MPlayer/releases/codecs/essential-20071007.tar.bz2
wget http://rubyforge.org/frs/download.php/17497/flvtool2-1.0.6.tgz
wget http://easynews.dl.sourceforge.net/sourceforge/lame/lame-3.97.tar.gz
wget http://downloads.xiph.org/releases/ogg/libogg-1.1.4.tar.gz
wget http://downloads.xiph.org/releases/vorbis/libvorbis-1.2.0.tar.gz
wget http://ftp.penguin.cz/pub/users/utx/amr/amrnb-7.0.0.2.tar.bz2
wget http://ftp.penguin.cz/pub/users/utx/amr/amrwb-7.0.0.3.tar.bz2
wget http://downloads.xiph.org/releases/theora/libtheora-1.0beta3.tar.gz
wget http://jetzweb.de/bluelotus/auvica_temp/ffmpeg-php-0.6.0.tbz2
wget http://jetzweb.de/bluelotus/auvica_temp/ffmpeg-r15261.tar.gz

3. Extract tarbal file.

tar xjvf amrnb-7.0.0.2.tar.bz2
tar xvjf amrwb-7.0.0.3.tar.bz2
tar xjvf essential-20071007.tar.bz2
tar xvjf ffmpeg-php-0.6.0.tbz2
tar xvzf ffmpeg-r15261.tar.gz
tar xvzf flvtool2-1.0.6.tgz
tar xvzf lame-3.97.tar.gz
tar xvzf libogg-1.1.4.tar.gz
tar xvzf libtheora-1.0beta3.tar.gz
tar xvzf libvorbis-1.2.0.tar.gz

4. Create folder.

mkdir /usr/local/lib/codecs

5. Install ruby and svn.

apt-get install subversion ruby libcurses-ruby

6. Get mplayer source.

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

7. Install codecs library.

mv /usr/local/src/essential-20071007/* /usr/local/lib/codecs/
chmod -R 755 /usr/local/lib/codecs/

8. Install Lame.

cd /usr/local/src/lame-3.97
./configure
make
make install

9. Install OGG.

cd /usr/local/src/libogg-1.1.4
./configure
make
make install

10. Install vorbis.

cd /usr/local/src/libvorbis-1.2.0
./configure
make
make install

11. Install flvtool2.

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

12. Install mplayer

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

13. Install for 3gp.

cd /usr/local/src/amrnb-7.0.0.2
./configure
make
make install

14. Install for 3gp.

cd /usr/local/src/amrwb-7.0.0.3
./configure
make
make install

16.

ldconfig

17. install libtheora.

cd /usr/local/src/libtheora-1.0beta3
./configure
make
make install

18. install ffmpeg.

cd /usr/local/src/ffmpeg
./configure –enable-libmp3lame –disable-mmx –enable-shared –enable-libamr-nb –enable-libamr-wb –enable-nonfree
make
make install

19. Link lib.

ln -s /usr/local/lib/libavdevice.so.52 /usr/lib/libavdevice.so.52
ln -s /usr/local/lib/libavformat.so.52 /usr/lib/libavformat.so.52
ln -s /usr/local/lib/libavcodec.so.52 /usr/lib/libavcodec.so.52
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
ln -s /usr/local/lib/libamrnb.so.3 /usr/lib/libamrnb.so.3
ln -s /usr/local/lib/libamrwb.so.3 /usr/lib/libamrwb.so.3

20. Install ffmpeg-php.

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

21. Load extension to your php.ini.

echo ‘extension=ffmpeg.so’ >> /etc/php5/apache2/php.ini

22. Restart your apache

/etc/init.d/apache2 force-reload

23. If everything fine you can see ffmpeg-php on you phpinfo();

ball Written by:

Teerapat Khunpech Live, Tech, Beers, Bike, Cafe Racer, Docker, Devops, Eco-System