Sunday, September 14, 2008

Converting AVI/MPG to 3GP files in Linux

The best way to convert an AVI/MPG video file to 3GP (like for viewing them on your cellphone) is to use the opensource program - ffmpeg. The ffmpeg was also the starting point for the most famous movie player for linux - the mplayer suite.

To start using ffmpeg, First download the latest ffmpeg source code. Run configure on it using the following command line, followed by a make and make install.
./configure --enable-nonfree --enable-gpl --enable-libamr-wb --enable-libamr-nb
--enable-libmp3lame
If you do not have the libamr-wb and libamr-nb codecs installed, download the following packages - amr-nb-7.0.0.2 and amr-wb-7.0.0.3 - and configure, compile and install them. The description of these packages is given in detail here.

NOTE that if you have FFmpeg installed, you need to make sure that you see both --enable-libamr-wb and --enable-libamr-nb in the configuration. You can check the configuration of ffmpeg by running ffmpeg > /dev/null.

Then run the following command to convert the AVI/MPG files to 3GP
ffmpeg -i inputfile.mpg -s 176x144 -b 300k -r 10   -ar 8000 -ab 12.2k 
-ac 1 -f 3gp -aspect 4:3 outputfile.3gp
Upload to your cell, and it will help you get over lots of boring times :)

No comments: