Sunday, February 13, 2005

The video plugin conspiracy

I have been converting some of my videos to avi+divx lately. I really don't like to need a ton of codecs and other software that either becomes proprietary, or needs proprietary programs to be read, or locks you in with DRM... grrr... so here's how to do some interesting stuff on a Windows box.

What do you do if you want to convert a QuickTime .mov file into .avi so you don't need the rather large QuickTime player on your machine? First, get QuickTime Alternative from the web, and once you install the DirectShow codecs, you can use AviSynth to read the .mov file (using the DirectShowSource function) into VirtualDub, and there you go.

What do you do if you want to convert a Windows Media file into .avi so you don't have to use Windows Media Player? Sometimes AviSynth doesn't like it one bit when you put one of those videos in the script - it reports lengths of several years and so on. You can work on that with VirtualDub, but you can also load some Windows Media files with TMPGEnc, which lets you save the whole thing as an uncompressed .avi file, which then can be easily processed with VirtualDub.

What if you don't have the right codecs for that Windows Media file? Piece of cake: load the file in Windows Media Player and let it install all the necessary codecs. There you go. For less proprietary codecs, you should consider installing FFDShow.

Side note: try to stay away from codec packs since they become a mess to manage as the codecs become outdated or if you want to uninstall. Sometimes they pull good stuff out with them. If you install the right codec individually, things are much easier.

What if your player refuses to play a file and claims it doesn't even know what codec is needed? Or what if you know you have the codec, but the video still doesn't play right? If you have an .avi file, you can use GSpot to find out what's going on. If you need software, you can look up the 4 character code GSpot gives you (fourCC), and you can usually get codecs with that. Some other times though, it's a matter of a bad or incorrectly installed codec.

What if a bad codec gets in the way? For most codecs, it's pretty simple. Just go find the .dll, .ax or whatever file the codec is registered with, and do regsvr32 /u filename. Done, no more silly codec. And if you get such codecs or want to reinstall them, then regsvr32 filename works just fine.

Some videos, especially .mpg files that contain NTSC or PAL video, have interlaced frames. You can deinterlace them and adjust the field positions using AviSynth+VirtualDub so that now even/odd lines overlap properly, and now you have the same video but with twice the framerate. The difference is huge and stuff looks so much nicer, even with less "resolution" so to speak.

In addition, .mpg players tend to blend the odd/even fields together so that you do not see zig-zags in the video because of interlacing. Deinterlacing gets you twice the framerate and no more blurring. By the way, video cameras tend to interlace the video they capture... hint-hint...

In addition, there are some ways to take each field and "complete" it with information from the next field doing some smart interpolation so that it doesn't produce zig-zagging. This creates a full resolution 50-60fps video with all the temporal and spatial information available. However, this can sometimes create a file that modern computers cannot decompress in real time :(.

If you are into collecting videos, I hope this info will be useful for you. Except divx, I think all software I used to do the conversions is free. You can replace divx with its cousin xvid. They are more or less compatible with each other.

No comments: