Magikomik

How to convert .3gp videos to .avi

Filed under: Video on Linux — Marko November 29, 2006 @ 2:45

ANd here is how to convert those mobile .3gp videos to .avi on Linux. I am using several tools, that all seem like a big confusion and it is confusion: ffmpeg, transcode, mencoder… what those commands are, the God knows.

I found out that my videos extracted from Sony Ericsson k700i have some kind of encoded sound which is not automatically compiled in the tools above. So the first thing was to download the newest ffmpeg and inside of the source I followed instructions from libavcodec/amr.c so that was most important part. I made the directory inside, and followed these commands:

mkdir amr

wget -nd http://www.3gpp.org/ftp/Specs/archive/26_series/26.104/26104-540.zip

then unzip the files and the source. You will find some c-code directory, so move everything from that one into the upper directory libavcodec/amr and go back to ffmpeg main source directory, type:

./configure –enable-amr_nb

make

and than as root or with sudo:

make install

After that I made stupid perl script to handle .3gp conversion from all .3gp files in the directory into the .AVI files:

#!/usr/bin/perl
use File::Basename;

unless($ARGV[0]) { exit }

foreach my $filename (@ARGV) {

unless(-e $filename) { next }
my ($file, $path, $suffix) = fileparse($filename, ‘.3gp’);
unless($suffix eq ‘.3gp’) { die “Not .3gp file\n” }
my $audio_command = qq{/usr/local/bin/ffmpeg -i “$file$suffix” -acodec mp2 -ar 22050 -f wav temp_audio.mp2};
my $ffmpeg_command = qq{/usr/local/bin/ffmpeg -i “$file$suffix” -r 29.970 -an -s 320×240 temp_video.mpg};
my $transcode_command = qq{transcode -i temp_video.mpg -y xvid,null -g 320×240 -f 29.970 -o temp_video2.mpg};
my $mencoder_command = qq{mencoder -audiofile temp_audio.mp2 -o “$file.avi” -oac copy -ovc copy -lavcopts vcodec=xvid tem
p_video2.mpg};

system($audio_command);
system($ffmpeg_command);
system($transcode_command);
system($mencoder_command);

unlink(’temp_audio.mp2′);
unlink(’temp_video.mpg’);
unlink(’temp_video2.mpg’);
}

Blowing and tying the grandmother’s knot

Filed under: Instructions — Marko @ 2:18

Global Warming at Swabian Highlands

Filed under: Latest News — Marko @ 2:07

Worst video, converted from .3gp

Filed under: Latest News — Marko @ 1:55

Well I discovered YouTube, too…

Filed under: Latest News — Marko @ 1:29