I set out to answer that mythical question about the best way to do that infamous "DVD Backup" due to my facination with compression and home theatres. I thought it would be interesting to post some of the results I had encoding things, as well as sharing what settings I use and a little explanation behind it.
This blog isn't going to necessarily provide scientific analysis, it's my personal experience using the tools I have had good success with, and the settings I have found are realistic. Your mileage may vary and I'd love to hear from other people.
Normally if I had some encoding to do I would simply open up AutoGK which will import the VOB files, generate an AVISynth script based on the file size you are targeting and do a two pass Xvid encode with whatever audio settings you desire as well. For anyone who ever had to use all these tools separately it can be beyond tricky to actually do it correctly and consistently.
The problem I've had with Xvid is that it leaves a artifacts around edges in animation, and generally smoothes things over a little bit too much in films -- again this is at the bitrates I use which are usually rather low compared to the source. This isn't an exercise in being picky as much as it is getting the best value out of each bit so when you scale up your videos to larger displays it retains its sharp look.
The Setup
Xvid is an MPEG4 ASP compliant encoder, and it is arguably simply the best ASP codec. There is another profile in the MPEG4 spec however called AVC which HD-DVD and Apple's QuickTime use for example. For MPEG4 AVC I decided to use the wildly popular X264 which is distributed as a command line tool that takes AVISynth input and outputs MP4 compliant files. I'm not going to get into the technical details behind comparing ASP and AVC -- suffice it to say AVC is significantly slower and can pack away the bits in a more effective way than an ASP as a result of its increased analysis and features. In addition it's well documented the amount of hacks Xvid has to do in order to facilitate some of the more advanced encoding techniques like B-frames into the AVI container -- so I thought it would be fun to try AVC out and a newer container.
In addition to using the Xvid/Avi output from AutoGk I decided to also use the AVISynth script it generates as the input for X264 which would help keep the comparison a little more interesting. The settings I used for X264 were designed to get the best bang for the buck from the encoder -- maximize quality, speed, and decoder compatibility. In AVC for example QuickTime does not support all the AVC features such as b-pyramids or 8x8dct so I dropped them. While it's tempting to jack up the b-frames higher it adds overhead on the decoder with little overall benefit after a certain point. The only deviation from these settings I've used is in animation (not shown here) I increase the reference frames from 5 to 8 due to the fact that animation has a more redundant frames.
The last thing to mention is that decoding AVC has a lot more overhead at high resolutions than ASP does, you pay for those advanced compression features.
The Results
The results below are a comparison of a 2-pass encode at the same bitrate from the same AVISynth script -- the target file size for each movie was the common 1400MB. I'm not claiming this is a great direct comparison since I'm using AutoGk, but it's a fun experiement and AutoGk does use a good set of Xvid settings (Motion Search, B-Frames, etc).
I should probably also mention that I own these movies, and did this to research MPEG4 encoding which is something I have a keen interest in. I would only advocate this as a method to backup things you own naturally.
X264 options (excluding bitrate and pass number)
--partitions all --direct auto --progress --threads 1 --subme 7 --b-rdo --mixed-refs --bime --weightb --bframes 3 --ref 5 --me umh --trellis 2 --no-psnr
Tomb Raider

This film has the advantage of being filmed at 2.35, so there isn't as much data after being cropped. The bitrate was about 1800, so there was plenty of bitrate to work with for the careful VBR encoder. I chose scenes with water because they are traditionally difficult to encode, combined with a slight film grain that's sure to drive it crazy. Both codecs did a great job here tho, but, in frame 9873 with Xvid notice if you can that on Lara's face there is macro blocking unfortunately.
BaseketBall

Luckily this film is 16:9 native, so there is tons of data for the encoder to look at. At first glance the Xvid encode actually has more detail, but when you enlarge you can see significant macro blocking in some areas as shown in the 4X Zoom window.
Conclusion
It won't shock anyone when I say AVC in an MP4 container is better than ASP in AVI, which is the most common combination. The images above at least provide a rough reference point for how much better the quality you can expect between the different mpeg4 profiles encoding the same content. This article isn't necessarily the catch all for every option -- these are the options I felt were reasonable and common based on my research using tools normal people would likely have access to. It's also worth mentioning that AVC encoding is slower by nearly a factor of 10x compared to ASP, obviously you are not getting 2x the quality for that either. Comments questions, let me know.

June 27th, 2007 at 07:03:25 PM