Converting 3GP video files HOWTO      2004.09.26 @ 4:10:58 PM
I've been playing with the video recording on my Nokia 7610 this weekend and thought it would be great if I could add video support to my fotoblog. Basically I would be capturing and publishing in my webpage real-time video clips in addition to my still pictures.

The Nokia phone generates 3GPP video files and the main challenge here is to convert such files into something that would play in any computer without requiring any special codecs or software. Even though Nokia distributes a codec for free and Quicktime now supports 3GPP, I want anyone to be able to painlessly play my videos on any computer. As far as my linux box, I can only play 3GPP videos with Realplayer 10 as MPlayer lacks audio support for this codec. The actual codecs are:

Codec: H263 Video
Bitrate: 65.9 Kbps
Codec: AMR Narrow-band Audio
Bitrate: 12.8 Kbps

In order to play the video stream, Mplayer requires a minor modification to codecs.conf by adding the 0x33363273 format to the ffh263 codec as follows:

videocodec ffh263
info "FFmpeg H263+ decoder"
status working
fourcc H263,U263,h263,X263
fourcc viv1 h263
driver ffmpeg
dll h263
out YV12,I420,IYUV
format 0x33363273

As far as the audio it is supported by libavcodec, but for some reason it doesn't work properly with MPlayer. I did some quick research with Google but did not find any evidence that would indicate the opposite. However, it does work with ffmpeg by downloading the drivers from This can be achieved as follows:

tar -zxf ffmpeg-0.4.9-pre1.tar.gz
cd ffmpeg-0.4.9-pre1/libavcodec
mkdir amr
mkdir amr_float
cd amr
unzip ../
mv c-code/* .
cd ../amr_float
unzip ../
mv c-code/* .
cd ../..

Once the right stuff is in place, a minor modification must take place in libavcodec/amr/makefile. The CFLAGS must be replaced (around line 68 ) with:


ffmpeg can now be compiled and installed with:

./configure --enable-amr_nb --enable-amr_nb-fixed
make install

Unfortunately, I was unable to encode any videos with ffmpeg that would play directly in a Windows box even though I tried all codecs and options. Therefore my only choice was to extract the audio out of the .3gp file into a separate file and then use mencoder to encode the video and audio stream into, let's say, a regular mpg file. The audio stream can be extracted, for example, into an mp2 file with:

ffmpeg -i movie.3gp -acodec mp2 -ar 22050 -f wav audio.mp2

Now I have a playable audio stream which can be merged into an mpg file with mencoder. Mencoder is a part of Mplayer and comes preinstalled with most linux distros, but here is a quick installation guide just in case:

tar -jxf MPlayer-1.0pre5.tar.bz2
tar -jxf essential-20040922.tar.bz2
mkdir /usr/lib/win32
mv essential-20040922 /usr/lib/win32
cd MPlayer-1.0pre5
make install

Now we can merge the audio.mp2 file and the original movie.3gp into a movie.mpg file as follows:

mencoder -audiofile audio.mp2 -o movie.mpg -oac copy -ovc lavc -lavcopts vcodec=msmpeg4v2 movie.3gp

That is it. Here is a sample file:


UPDATE: Ivo Marino has written a quick script for converting 3GP files.
UPDATE 2: There is a new script available called

All knowledge and software published in this website is released under the GNU General Public License (GPL)