Converting a movie (.avi) to play on a cell phone (.3gp) on Mandriva Linux

I created this script which will convert a movie to play on a cell phone (.3gp format). It works on Mandriva linux, and uses ffmpeg (because my version of mp4creator didn't work).

#!/bin/bash

INPUT=YOUR_MOVIE_NAME_HERE.avi
OUTPUT=movie.3gp
VBITRATE=50
ABITRATE=16


# No user servicable parts beyond this point!
rm $OUTPUT #Remove any previously made movies with the same output name.
#Encode the video to MPEG4, using 2 passes, 2nd pass could be removed for speed
mencoder $INPUT -ovc lavc -lavcopts vcodec=mpeg4:vbitrate=200:vpass=1 -zoom -vf scale=176:144 -nosound -ofps 14.985 -ffourcc DIVX -o tmp_out.avi

mencoder $INPUT -ovc lavc -lavcopts vcodec=mpeg4:vbitrate=200:vpass=2 -zoom -vf scale=176:144 -nosound -ofps 14.985 -ffourcc DIVX -o tmp_out.avi

#seperate the audio from the original video.
mplayer $INPUT -vo null -ao pcm:file=tmp_out.wav -af resample=16000,volume=3

#Use ffmpeg to create the .3gp file and do AMR encoding.
ffmpeg -i tmp_out.avi -i tmp_out.wav -b $VBITRATE -ac 1 -ar 8000 -ab $ABITRATE $OUTPUT

#Remove some temp files…
rm tmp_out.avi
rm tmp_out.wav
rm divx2pass.log

Leave a Reply

Your email address will not be published.