Tuesday, June 24, 2008

Transcoding Canon SD400 videos for Google Video

Google Video has been glitchy lately when I've uploaded the .AVI files I get from our Canon SD400. Every time I uploaded one, it would just give me 2 silent seconds of grey. I did a little poking around and came up with the following mencoder (part of mplayer) incantation to transcode to MPEG-4 (with MP3 audio):

mencoder -o out.mp4 -oac mp3lame -ovc lavc -srate 11025 \
-channels 1 -af-adv force=1 -lameopts preset=medium \
-lavcopts vcodec=mpeg4:vbitrate=2048 in.avi

That gets Canon's slightly weird format into something Google Video can handle, at a pretty good quality level. If you've got a batch of files to transcode, you can use the following shell script:

#!/bin/bash

for f in "$@"
do
mencoder -o "${f/%\.[Aa][Vv][Ii]/.mp4}" -oac mp3lame -ovc lavc
-srate 11025 -channels 1 -af-adv force=1 -lameopts preset=medium \
-lavcopts vcodec=mpeg4:vbitrate=2048 "$f"
done

That will create X.mp4 from X.avi without altering the latter. As a plus, it will drop the size by about 85% to 90%.

Labels: , ,

0 Comments:

Post a Comment

Subscribe to Post Comments [Atom]

<< Home