By now, you are probably a super-awesome movie encoder. If not, check out part I and part II of this series of guides. Also see doom9.net for a more in-depth (though less straightforward and formulaic) discussion of just about any part of the encoding process.
(We are not responsible for any laws you violate while using our guide; it is intended for legitimate backups of DVDs you already own.
With current legislation, it is impossible to know exactly what is legal without a lawyer, and we don't claim to.)
You'll still need the usual suspects, like VirtualDubMod and OggDropXP.
But you'll now need the XviD codec, instead of DivX. The XviD codec can be obtained from www.xvid.org.
Setting Up XviD
After installing the XviD codec, load your AVS file into VirtualDubMod, and add any audio tracks you want. Then go to the Video menu and choose Compression, XviD, Configure. You should be looking at something like this:
If you see anything set to something else, set it to match that picture. Then click the "more..." button next to the Profile Level. Set it to look like this:
Then click the "Edit Matrix..." button. This is where you decide how much, and what type of data will be discarded. XviD uses a Fourier transform mechanism (similar to that of JPEG) to represent an 8x8 block of pixels by spatial frequency, rather than by spatial position. Higher quantizer values (the numbers in the matrix) represent MORE compression (more data is discarded). In a none-too-obvious way, the values for this matrix are representative of how much data will be discarded. The numbers in the upper left part of the matrix represent, to the best of my knowledge, low-frequency coefficients (you want to have relatively low numbers here). The numbers in the lower-right part of the matrix represent high-frequency coefficients (you generally want higher quantizer values here). Here is a sample matrix:
In general, you want all these numbers to be higher for more compression (to obtain lower bitrates), and lower for less compression (to obtain higher bitrates). If you use a matrix with large quantizer values, then try to encode at high bitrate, the filesize will turn out too small. Likewise, if you use a matrix with small quantizer values, then try to encode at low bitrate, the codec won't play ball and your filesize will end up too large. Now, go back to the main XviD Configuration window and click the "more..." button near the bottom. Make your Motion tab look like this:
and your Quantization tab look like this:
The quantizers in this second panel are sort of "global" quantizer minima and maxima for the three types of frames. I-frames are your keyframes, which are like low-compression JPEGs. P-frames are your progressive frames, which are basically the preceding frame, with a few changes added in. B-frames are bi-directional frames, which are composed of both the preceding AND the following frame! XviD is very good at saving data by using B-frames. You will note that elsewhere we have told XviD that it can use at most two B-frames in a row.
I have chosen the quantizers 2,3,2,5,2,6 for good reason. If you allow the codec to select a quantizer of "1" for a frame, that frame will be REALLY large, and suck up an inordinate amount of bitrate, which is bad. Likewise, if you allow the codec to select a very large quantizer (like 15 through 31), you will get some frames that look like utter garbage (because too much data has been discarded for that frame). So, I keep the I-frames looking really nice (but not TOO nice) by only allowing Q = 2 or 3, and the P-frames and B-frames looking pretty good with their respective quantization limits. Feel free to experiment with other values, especially if you are doing extremely high- or low-bitrate encodes (like below 600 kbps or above 3000 kbps). Personally, I find it easier to leave these quantizers where they are, and simply load a matrix that best matches the bitrate and complexity of the video.
Encoding With XviD
Once you have any audio tracks and/or filters loaded, and your video is ready to encode, go back to the XviD Configuration window and choose "Encoding type: Two-pass - 1st pass", then click the "more..." button next to it. Make sure "Discard first pass" is checked. Now set it to "Two-pass - 2nd pass", and click the "calc..." button. Choose the target size of your file. I like to use 1136640 for the size, as this will give you a file about the size of 1/4 of a DVD-R. Choose OGM for the format. Choose the total video length. Finally, choose the total bitrate of all your audio streams at the bottom (this is easily checked in Winamp). It should look something like this:
Press OK to return to the main Configuration window. If you are like me, you often like to include credits because they have cool music playing during them. However, there is often nothing worth looking at on the screen. If this is the case, XviD has you covered. Locate the exact frame number at which the credits begins. In the "Zones" pane, click "Add", click on the newly-created zone, then "Zone Options". Set "Start frame #" to whatever frame is at the beginning of the credits in your video. Set "Quantizer" (rather than "Weight") equal to 31 (the largest allowed quantizer value). If your video is a cartoon, you should also set BOTH zones (the normal zone and credits zone) to "Cartoon Mode" by checking that box. If your video has cartoons and live action simultaneously...well, let's not consider that. It should look something like this:
Now set it back to "Two-pass - 1st pass", and use F7 to queue your first pass. Then set it back to "Two-pass - 2nd pass" and use F7 to queue up the second pass. Use F4 to open Job Control, and start the encoding process.
When your video is done, as always, make sure it is the proper filesize, and that the video gets crappy at the proper location (at the beginning of the credits).
You may be wondering which matrix is right for your video. Here are some guidelines. The higher the resolution of your video, the higher the matrix values you will have to use for your matrix to get it to come out the proper size. Likewise, the longer the video, the higher the matrix values you'll have to use to attain the proper filesize. The same goes for videos with lots of action. I have provided these matrices for your use. Each of these matrices will be capable of covering a certain bitrate range, for a video of a given length, resolution, and complexity. There are points at which they will simply REFUSE to go any higher or lower, though. Don't expect them to cover every situation. You might have to create your own custom matrix. Here they are:
Very High Bitrate
Happy encoding, folks!