Thursday, January 24, 2008

DivX Noobs

I saw this question today so I'm posting my response here for everyone.

> I am seeking a way to covert my dvd's to a video file format.
> I am looking to use mp4 or divx...

In the USA it is illegal to circumvent the copy protection found on most commercial DVDs. However, if you have an unprotected DVD, you can use DivX Converter to convert the DVD to a DivX file.



For example, I have a DVD from my wedding. I paid the videographer for the footage and he gave me an unencrypted DVD. I put that DVD into my computer and can see the contents of the disc. In one of the sub-directories there is a set of large files with names ending in VOB.

Drag and drop the VOB files into DivX Converter, select the "Home Theater" profile, wait a while, and you'll get a file out with a name ending in divx that is about one quarter the size of the original VOB files. Converter automatically stitches the VOBs together into one file. Take that divx file, burn it on to a CD-ROM and you can watch it on any DivX Certified DVD player. There are many models to choose from starting from as little as $40.

Go to www.divx.com for the software. The DivX Converter software is free, but you'll need the optional ($10) MPEG2 plug-in to read VOB files. If you are converting lots of videos, consider upgrading to DivX Pro ($20) that will convert files faster and/or provide better quality.

Beware of software that says it creates "DivX" files but is not actually certified by DivX or does not use the DivX encoder. There are lots of free converters out there, many based on FFMPEG, MENCODER, and/or XVID that do not use the fast, high-quality DivX encoder. I only use DivX Converter, Dr. DivX, StreamClip or VirtualDub. I avoid ffmpegx, handbrake, etc.

Advanced Encoding

So you've tried DivX Converter but you've found you want more control over the encoding process. I'd suggest using software that gives you direct access to the DivX encoder options.

For Mobile, I always crop to 4:3 aspect ratio then scale to 320x240 (qVGA) and keep the video bitrate around 300 kbps. Lanczos is the best resize filter. Always crop off any black borders that may appear around the original video. You waste lots of bitrate trying to encode a sharp black frame around your video. Get rid of them.

For all encodings, I take advantage of the optional enhancements offered by DivX Pro. That means, Multipass (fast first pass), Insane Quality, Experimental SSE4 Search, Enhanced Multithreading, Bidirectional coding, Auto Noise Reduction, Optimized Quantization, Shaping Psychovisual Enhancements and Enhanced I-Blocks. For grainy video, I use Masking Psychovisual Enhancements.

Multi-pass provides better quality and better control of the bitrate. For example, if you try 300 kbps with 1 pass, you might get 275 kbps or 325 kbps. With fast first pass, you will usually get within 2 kbps of your target rate. If you really want exactly the target rate, make a slow first pass.

If you don't care about rate, use the "1-pass quality based" setting. It's really the best and fastest method. You let the encoder choose the optimal bit-rate based on the content. I typically use a Quality setting between 3.5 and 5.0 depending on the content. Unfortunately, with this setting, you don't know what bitrate you'll end up with and you could easily get something your phone can't handle, so I don't use this setting for Mobile sized videos.

I never mess with the max key frames and keyframe threshold. Theoretically you could optimize those settings based on your content. For example, if you have lots of video of a talking head, use a very high max key frame. If you have lots of panning or short, similar scenes, lower the max or the keyframe threshold. By default, you'll get a key frame at least every 3 seconds and I rarely try to tweak it.

For more detail about what all these settings mean, see the Dr. DivX user guide.

Don't forget about the audio. Many DivX videos have 128 kbps MP3 stereo audio. That's usually what you want for Mobile clips and a converter like VirtualDub will copy the audio stream as-is without re-encoding it. Unfortunately Dr. DivX will always re-encode the audio stream whether you need to or not. Sometimes I will use DivXMux to use the original audio stream and the converted video stream.

If you never use stereo headphones, you can save a few bytes by converting the audio to mono and drop the bitrate to 96 kbps.

No comments:

Post a Comment