To Configure Unconstrained VBR

[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.]

You can use unconstrained variable bit rate (VBR) encoding on a stream to specify an average bit rate that will be maintained in the encoded content. Unconstrained VBR differs from normal CBR in that the variance in bit rate throughout the stream can be greater.

The bit rate of the stream, set with IWMStreamConfig::SetBitrate, is used as the desired average bit rate. When encoding of the stream is complete, you can use IWMPropertyVault::GetPropertyByName to retrieve two additional properties: g_wszVBRPeak and g_wszBufferAverage. These properties describe the peak bit rate of the encoded content and the average buffer window of the content, respectively.

Unconstrained VBR must be used in conjunction with two-pass encoding. Two-pass encoding is not set in the profile. You must configure the writer to perform a preprocessing pass before writing the stream. For more information about using two-pass encoding, see Using Two-Pass Encoding.

To configure a stream in a profile to be encoded with unconstrained VBR, perform the following steps:

  1. Create a profile manager object by calling the WMCreateProfileManager function.
  2. Open an existing profile to which you want to add VBR support. For more information about opening profiles, see Working with Profiles.
  3. Get a stream configuration object for the stream you want to use by calling either IWMProfile::GetStream or IWMProfile::GetStreamByNumber.
  4. Get a pointer to the IWMPropertyVault interface of the stream configuration object by calling IWMStreamConfig::QueryInterface.
  5. Enable VBR encoding for the stream by calling IWMPropertyVault::SetProperty for the g_wszVBREnabled property.
  6. Set g_wszVBRBitrateMax and g_wszVBRBufferWindowMax both to zero with IWMPropertyVault::SetProperty.
  7. Save the changes made to the stream by calling IWMProfile::ReconfigStream.
  8. Save the profile, or pass it to the writer object.
  9. Configure the writer to perform a preprocessing pass.

Configuring VBR Streams