MPlayer for Linux (other platforms supported) ships with an awesome (free) audio/video encoder called mencoder.
It can accept a stream from say a TV tuner card or an existing audio/video file like an AVI or MPG. You can also use a DVD as a source.
It spits out another file, this time using any specified codec / formatting / special effects it supports.
So I have this .avi file and it cannot play back within anything I’ve got under Mac OS X. I fire up VMWare Fusion and a copy of Ubuntu within. Here I run ‘file myvideo.avi’ within a terminal and am told it’s actually Intel Indeo v5.
For those who don’t know, Intel produced their own audio/video codecs (like DivX but early days essentially) years ago before Windows supported many. Indeo was the product name. Unfortunately the specification is held privately by Intel and binaries are only available for past Windows OSs. Thankfully mplayer has a load of these old binaries and can play them under Windows. And most if not all can be used by mencoder to at least decode the files.
Time to update my video file by converting it to a newer, better supported format.
Now unfortunately the people behind MPlayer are far too busy programming to make great looking simple documentation. This means wading through piles of documentation and wondering which of the bewildering options should you be choosing. Google & Gentoo Wiki to the rescue! How about this for a wicked guide to using mencoder with examples!
Even after trying a few of the examples the converter still complained about things such as invalid audio bitrates. So I had to choose pcm for the audio codec which is uncompressed and thus not great.
Results time. Original file size is 390MB.
So here goes the first attempt:
mencoder movie.wmv -o movie.avi -ovc lavc -oac pcm
perfectly correct video under both Linux and Mac OS X with a file size of 323.5MB. But it’s DivX, how about we use xvid which is less restrictive.
mencoder -ovc xvid -oac mp3lame -xvidencopts bitrate=687 -o
Once again perfectly acceptable but this time the file size is 212MB with no perceptable degredation in quality (but the original is obviously old and hardly DVD or HD quality).
You could even add
-lavcopts vcodec=mpeg4:mbd=2:trell -vf scale=640:480 to double the video resolution from 320×240 if you desired but this adds considerable time to encoding so I didn’t bother.
Oh, and for those of you interested in real geeky hardware stats, iStat Pro reckons the CPU (Intel Core 2 Duo 2.4Ghz Santa Rosa) reached 78C in the middle of conversion. It even reckons 35% idle CPU which given the hammering is quite remarkable. 2GB RAM MacBook Pro.