Tag Archives: mpeg4

Encoding videos for Android with mencoder

I have a Sony Ericsson X10 which I watch a lot of videos on, mainly in bed before I go to sleep. While I mostly watch YouTube clips and such, sometimes I watch episodes of TV series which I put on the SD card. Unfortunately, Android doesn’t willingly play the normal PC video formats, and especially not H.264 encoded HD files, so I need to reencode the files to MPEG4.

Previously, I have been using FFmpeg to reencode my videos, mostly due to its relatively simple command line syntax. Today, I wanted to try mencoder instead, because I really like the flexibility it delivers. I don’t know if FFmpeg has the same features; at least I haven’t found them. I struggled a bit before finding good parameters to create a video file which Android can actually play. In the end, I settled for this command line:

mencoder -o test.3gp -ovc lavc -oac lavc
 -lavcopts vcodec=mpeg4:acodec=libfaac:vbitrate=800:abitrate=192:vglobal=1:aglobal=1
 -of lavf -lavfopts format=3gp -noskip -noautoexpand -vf dsize=854:480:0,scale=0:0,harddup
 -af channels=2,volnorm test.mkv

This can probably be tweaked to produce files which suit you better, but at least it’s a start.