Rotating video clips shot in "portrait" mode (revisited)

Some time ago I write about how to use mencoder to rotate videos. After playing around with mencoder some more today I found a better way of doing it, all in one go.

mencoder -ovc lavc -lavcopts vcodec=mpeg4 -vf-add rotate=1,expand=432:324,scale=640:480 -oac mp3lame -lameopts br=64:mode=3 -srate 22050 input.avi -o output.avi

This will run the video through three filters. The first one rotates, the second one expands and the third one scales. This time I’m expanding to 432×324 which is exactly 4:3.

The reason I’m scaling to 640×480 at the end is that I’m now using SmugMug for all my photos and videos. SmugMug scales the video automatically to 320×240 and 640×480. If the video I upload is smaller than 640×480 it won’t upscale it to 640×480 but will only keep a 320×240 version. The original is always discarded.

The mencoder command line also converts to mpeg4 for the video and mp3 for the audio. This way I don’t have to run the video through ffmpeg to make it work in Windows Media Player. I discovered that that last step seriously lowered the quality of the output.