Variable Bit Rate (VBR) Encoding

[The feature associated with this page, Windows Media Format 11 SDK, is a legacy feature. It has been superseded by Source Reader and Sink Writer. Source Reader and Sink Writer have been optimized for Windows 10 and Windows 11. Microsoft strongly recommends that new code use Source Reader and Sink Writer instead of Windows Media Format 11 SDK, when possible. Microsoft suggests that existing code that uses the legacy APIs be rewritten to use the new APIs if possible.]

Variable bit rate (VBR) encoding is an alternative to constant bit rate encoding (CBR) and is supported by some codecs. Where CBR encoding strives to maintain the bit rate of the encoded media, VBR strives to achieve the best possible quality of the encoded media.

The quality of encoded content is determined by the amount of data that is lost when the content is compressed and decompressed. Many factors affect the loss of data in the compression process, but in general, the more complex the original data and the higher the compression ratio, the more detail is lost in the compression process.

There are three types of VBR encoding: quality-based, unconstrained, and constrained.

Quality-based VBR Encoding

The first type of VBR encoding is quality-based, which uses one encoding pass. Quality-based VBR encoding enables you to specify a level of quality for a digital media stream instead of a bit rate. The codec will then encode the content so that all samples are of comparable quality.

The main advantage of quality-based VBR encoding is that quality is consistent within a file and from one file to the next. For example, you can write a program to copy songs from CD to ASF files on a computer. In this case, consistent quality is probably more important to the end-user experience than consistent file size. Using quality-based VBR encoding would ensure that all of the songs copied are of the same quality.

The disadvantage of quality-based VBR encoding is that there is really no way to know the size or bandwidth requirements of the encoded media before encoding. This can make quality-based VBR-encoded files inappropriate for circumstances where memory or bandwidth are restricted, such as portable media players, or low-bandwidth Internet connections.

In general, quality-based VBR encoding is well suited for local playback or high bandwidth network connections. In those cases, the consistent quality will provide a better user experience.

Unconstrained VBR Encoding

Unconstrained VBR encoding uses two encoding passes. When using unconstrained VBR encoding, you specify a bit rate for the stream, as you would with CBR encoding. However, the codec uses this value only as the average bit rate for the stream and encodes so that the quality is as high as possible while maintaining the average. The actual bit rate at any point in the encoded stream can vary greatly from the average value.

You do not set a buffer window for unconstrained VBR encoding as you would for a CBR-encoded stream. Instead, the codec computes the size of the required buffer window based on the requirements of the encoded samples.

The advantage of unconstrained VBR encoding is that the compressed stream has the highest possible quality while staying within a predictable average bandwidth.

Constrained VBR Encoding

Constrained VBR encoding is identical to unconstrained VBR encoding, except that you specify a maximum bit rate and a maximum buffer window in the profile. The codec then uses the maximum values to determine how to compress the data. If you set the maximum values high enough, constrained VBR encoding will produce the same encoded stream as unconstrained VBR encoding.

Choosing an Encoding Method

Codec Features

Configuring Streams

Configuring VBR Streams

Constant Bit Rate (CBR) Encoding

Two-Pass Encoding

Using Two-Pass Encoding