C++

Google

GNU Build System (configure.ac, Autoconf,Makefile.am,Automake)

Submitted by Ravindra on Thu, 2007-11-22 17:46.

Though i have done this a long time ago i had forgotten how. But recently i had to write a configure script recently for the GSOC OCR code i mentored and thought of blogging it.

out of the many manuals out there regarding the GNU build system , the following i like most.
http://www.amath.washington.edu/~lf/tutorials/autoconf/toolsmanual.html

As any one knows, the configure shell script, configures the source code to the installer platform and any C code ships with one nowadays.
After configuring comes the building process for which Make files are used.

permalink

FFMPEG-PHP

Submitted by Ravindra on Sat, 2007-06-16 02:51.


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 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
options were requird 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 stop
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

and 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.

permalink

Converting media to flash

Submitted by Ravindra on Fri, 2007-06-15 16:50.


These are the components you need
1. FFMPEG : to convert to flash
2. FLVTOOL2: to insert meta data that are required by a flash player to play flash

3. FlowPlayer: Though not need for the conversion, you can use FlowPlayer to play the flash file. To test the conversion you can even use mplayer , how ever mplayer does not need meta data info , thus a flv file playable through mplayer might not be playable by a flash player.

1. First of all make sure that you have the environment ready for compiling and you are familiar with compiling/installing PHP extensions(PHP extension requirement is for ffmpeg-php that will be covered in the next post).you can refer to http://r4vi.org/index.html/?q=node/38
for some help.

2. you can do an apt-get install for FFMPEG
apt-get install ffmpeg libpostproc0d libpostproc-dev libavifile-0.7c2 libavformat0d libavcodec-dev libavcodec0d libavformat-dev

This is more than enough for normal media conversions , but not for FLV creations. the reason is FLV uses mp3 for audio and default apt-get does not have the mp3 encoder.
so you need to download the source from http://ffmpeg.mplayerhq.hu/download.html
for me it was easier to do the download than the SVN.

3. Then before installing you might need to install lame.
I am not sure whether you need this step as ffmpeg source might contain the required code, how ever i had lame installed before ffmpeg source compilation, so you might as well do that.

install lame libraries
Add in your /etc/apt/sources.list
deb http://www.debian-multimedia.org lenny main

or
deb http://www.debian-multimedia.org testing main

and then do
apt-get install lame lame-extras liblame-dev liblame0
you should now have libmp3lame.so in /usr/lib

4. since i need mp3 encoding do a source compilation. The best source i found for this was http://vexxhost.com/blog/2007/03/03/installing-ffmpeg-ffmpeg-php-mplayer-mencoder-flv2tool-lame-mp3-encoder-libogg-%E2%80%93-the-easy-way/

./configure --enable-libmp3lame --enable-libogg --enable-libvorbis --disable-mmx --enable-shared
remember the --enable-libmp3lame part as that is the reason we are compiling from source to enable mp3 encoding through lame.

echo '#define HAVE_LRINTF 1' >> config.h

then make
and then make install

then repeat the other steps mentioned in the above mentioned tutorial.
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.5

i got an error for libmp3lame.so.0 , which is because i had installed lame before, so thats why i think you might not need to install lame , as ffmpeg install produces the libmp3lame.so.0.

well that should be enough for ffmpeg install. test by converting a media file, and in the conversion if you see notices of missing codecs ( like i did for mp3), then you might have to download them and put inside the ffmpeg , libavcodec directory and recompile with those codec support.

4. next step is FLVTOOL2, since its ruby based you will have to install ruby first
apt-get install ruby rbot ruby1.8-examples rdoc1.8 ri1.8

permalink
Syndicate content