thoughts on Web Design and Web Application Development

FFMPEG Installation

February 6th, 2008 by admin         
Vote This Post DownVote This Post Up (-1 rating, 1 votes)
Loading ... Loading ...

 

FFMPEG is a collection of software libraries that can record, convert and stream digital audio and video in numerous formats. FFMPEG will allow visitors to your site to upload a video of almost any format and converts it to a video format called FLV, which is a flash video. The main reason for doing this, is to reduce the potential for viewing trouble in to ensure the videos which are streamed and at a reasonable file size.

Step 1 - Compiling FFMPEG

A lot of the work in this tutorial is done in linux command line, so open up that console.

Ensuring that you have a reliable interent connection to your server, type out the following commands:

sudo apt-get build-dep ffmpeg
sudo apt-get install liblame-dev libfaad2-dev \
libfaac-dev libxvidcore4-dev checkinstall fakeroot
DEB_BUILD_OPTIONS=risky fakeroot apt-get source ffmpeg –compile

Install all the deb packages that are created. A little finer control could be exercised if instead of setting DEB_BUILD_OPTIONS, the debian/rules file can be edited.

Additional configuration

(Some steps may be excluded as were performed above)

First, get your dependencies:

sudo apt-get build-dep ffmpeg
sudo apt-get install liblame-dev libfaad2-dev \
libfaac-dev libxvidcore4-dev liba52-0.7.4 \
liba52-0.7.4-dev libx264-dev checkinstall \
build-essential subversion

Step 2 - Next, grab the ffmpeg source:

Type the following command in your console:

svn checkout -r 8998 svn://svn.mplayerhq.hu/ffmpeg/trunk ffmpeg

If you’re feeling adventurous, you can try the very latest code by omitting the -r 8998 part of that line. Revision 8998 is the latest at the time of writing, and worked for us.

Now you can configure and build ffmpeg. Use the following commands, this takes a little while:

cd ffmpeg
./configure --enable-gpl --enable-pp --enable-libvorbis \
--enable-libogg --enable-liba52 --enable-libdts \
--enable-dc1394 --enable-libgsm --disable-debug \
--enable-libmp3lame --enable-libfaad --enable-libfaac \
–enable-xvid –enable-pthreads –enable-x264
make
Finally, install it. checkinstall gives you the option to edit some parameters: I set the name to ffmpeg and the version to 3:0.svn20070511

sudo checkinstall

Step 3 - Install FFMPEG-PHP

ffmpeg-php is a very useful php extension which provides several methods to query information on the uploaded media. if you are going to do media conversion , you have to know the frame size, frame rate,ect of the input file, and ffmpeg provides those facilities. What ffmpeg-php does is, it provides an PHP interface to ffmpeg tool.

Installing ffmpeg-php is trivial. But make sure you have FFMPEG properly installed , please read the previous post for that.

Download the source code from


http://sourceforge.net/project/showfiles.php?group_id=122353&package_id=133626

Untar the file and then…

phpize

./configure --enable-ffmpeg-php --with-ffmpeg-php --enable-maintainer-zts --enable-debug --with-php-config=/usr/local/php/bin/php-config

Note that –enable-maintainer-zts –enable-debug –with-php-config=/usr/local/php/bin/php-config

A few options were required to ensure this extension complies with the PHP installation i have. so you might not need those.

make
make install

Then…

vi /usr/local/php/php.ini
cp /usr/local/php/lib/php/extensions/debug-zts-20060613/ffmpeg.so /usr/local/php/lib/php/extensions/
apache stopp
apache start
php -r ‘phpinfo();’ | grep ffmpeg
you should see
ffmpeg
ffmpeg support (ffmpeg-php) => enabled
ffmpeg-php version => 0.5.0
ffmpeg.allow_persistent => 0 => 0

php -f ext/ffmpeg-php-0.5.0/tests/test_ffmpeg.php

You should get a page with various info with ffmpeg and ffmpeg formats,ect. You can do further tests by using the media provided by ffmpeg-php source.

The Final step - finding a cool player

You now need a cool video player, we recomend this one:

JW FLV PLAYER 3.12


 

Posted in Install | Check Comments |

Leave a Comment

Please note: Comment moderation is enabled and may delay your comment. There is no need to resubmit your comment.

Blogge - Web Design Blog hosted by Web Design India