Everything you need to encode in AVC/H.264. Period.
Welcome to DeathTheSheep's AVC VfW Encoding Guide, the informative and easy-to-use guide made to help you get the most out of your AVC encodes. Whether you are a newbie or an expert looking to improve your grasp on the subtleties of encoding, jump right in. Basically, you can substitute this guide in just about *any* encoding guide where it talks about configuring Xvid/DivX. Onward! Baaaa!
But first, some terminology. In order to make full use of this guide, it's best to have a working knowledge of the encoding vocabulary it uses.
1. Codec: Compressor/Decompressor. Here, x264 is the codec, also known as an "encoder." DivX is a codec. Xvid is a codec. If you downloaded the DTS_x264 package, you now have the encoder (the part that compresses the video) along with the decompressor, also known as a "decoder" (the part that lets you play the videos you produce or "encode"). You will probably never have to adjust the decoder software, so this guide doesn't mention it. Note that "codec" is different from a "standard:" H.264 is the standard on which x264 is based. MPEG4-ASP is the standard on which Xvid and DivX are based. MPEG4 is not a codec. It is not an MP3. It is a standard.
2. Bitrate: This related to the final file size ("filesize"). The higher the bitrate, the higher the quality, the larger the file. It is usually expressed in units of (data/time), such as KB/sec or kbps. Scenes in a video with high amounts of motion tend to need more bitrate in order to turn out in acceptable quality since the more motion there is, the more data the codec must store in the file.
3. Quantizer: A unit upon which the encoder's decisions about quality are based. Note that higher quantizers yield lower quality and lower bitrate (and thus less filesize).
4. Pass: One full round of processing the input source file. Depending on which mode you choose, the codec will have to go through the file a certain number of times. The first time through ("Pass 1" or "First Pass") is used to get to know your source video, and the codec writes about what it sees in a "pass file," which it uses the second (or third) time through the video to decide how much bitrate and what quantizers go where in order to produce the best quality it can. Note that in the "constant" quality or "constant" quantizer mode, there is only one pass because the codec already knows what quality to encode at--this quality value is specified by the user. It is also independent of bitrate; the codec will simply take as much as it needs to achieve the specified quality.
5. Encoding speed: Defined as "how long it takes for the encoder to process/encode the entire file, at any given point in time, expressed in frames/sec (fps)." This means that you have an overall or average encoding speed (based how long it took from start to finish), and instantaneous encoding speeds throughout the video processing, varying during each scene of the video. Encoding speed tends to be lower when processing high-motion scenes.
I recommend multipass mode for all of encodes you wish to reach a certain filesize. That's right, if you require your final filesize to be exactly 170.00MB, for instance, you're going to have to do a 2- or 3-pass encode. 1-pass mode is strictly for those who are severely short of time or do not expect to attain high-quality output. 2 passes tends to be sufficient for most people's needs, producing high-quality files with accurate filesizes. However, single-pass mode is sometimes used to produce constant quality output. See the Constant Quantizer and Constant Quality Modes section below if you wish to encode in a uniform, constant quality regardless of the filesize.
If you don't have to have your videos reach a certain, explicit filesize, or prefer to let the encoder decide what filesize to give it for best quality, you might consider looking into a fixed, stable quality encoding via the “Single Pass - Quantizer” or "Constant Quality" modes. The difference between these 2 modes is that "Constant Quality Mode" (new!) uses more advanced rate control algorithms to reduce the bitrate in high-complexity scenes where the eye is less likely to focus on details. This means the quality appears constant even as quality is dynamically allocated to where the eye notices it best. Many folks would argue that Constant Quality Mode is better, as it is designed to be. However, if you are encoding very low bitrate animated videos, Quantizer may be the better choice.
If you wish your video to reach a specific, accurate filesize at the end of the encode, you'll need to use a multipass mode.
This section provides the steps necessary to produce the best mix of encoding quality and encoding speed. Following are the recommended settings which produce the maximum quality AVC encodes while maximizing encoding speed.
Inherent in the AVC format is an exceptionally useful feature which reduces blocking and other encoding artifacts that have so plagued many of the predecessors of AVC. It is extremely useful in AVC encoding, and due to the fact that AVC is built around this filter and you may experience excessive amounts of blocking and video artifacts (bad stuff), this deblocker should generally not be disabled for normal use. However, due to the fact that it takes up immense amounts of decoding time, you may consider disabling it to achieve the fastest possible decoding speed (Xbox, handheld, etc) if the decoder doesn't support disabling it on the fly.
Bear in mind that the very principle of in-loop filtering (deblocking) is rather controversial due to the fact that the human visual system (HVS) often misinterprets the flaws and blocks in spatially complex scenes as the scene's actual detail. Because x264 removes this artifacting by default, the HVS perceives this to be a "loss of detail" even though technically x264's detail is just as accurate—even more so, in most cases, at similar bitrates. Indeed, the general consensus as of yet (heavily supported by Doom9's codec comparison and the quality metrics) is that x264 does tend to keep more detail more accurately than ASP (non-deblocked) codecs at similar bitrates. However, the deblocker's removal of artifacts is occasionally confused by the HVS as a removal of legitimate detail by people accustomed to encoding without a deblocking filter. However, for people who consider noise in their video encodings to contribute to a "warmer" and more pleasing picture, the deblocker's removal of this noise is often unfavorable to them. This preference is subjective from person to person, so take the effort to find out what settings best suit your eyes/needs.
The alpha deblocking threshold "strength" (P) helps to determine how strong of a deblocking effect is needed to eliminate blocks. The beta deblocking "threshold" (See 'Q' in above illustration) determines how much of the material actually needs to be deblocked. The higher this is set, x264 will perceive more of the video as blocks (often too much of the video, if set too high), so the more the deblocker will act upon. Naturally, if you don't wash (deblock) enough of the material, there will still be some stains (blocks) left, away from the washed area. Think of it like washing a shirt. If you don't wash (deblock) hard or strong enough, the stains (blocks) simply won't fade/disappear. However, if you wash too much material or scrub too hard, you'll ruin the shirt, because instead of stains, there will be the ugly lack of color where all the texture and detail rubbed out.
Both bars are initially set to 0 for a reason: this is the standard deblocking that will lead to the highest metric quality balance of block removal and detail retention. If, however, you find the default 0,0 result unsatisfying, look to these tips:
Last updated: Feb 21, 2008