To Configure Constrained 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 constrained variable bit rate (VBR) encoding on a stream to specify an average bit rate that will be maintained in the encoded content. You also specify the maximum bit rate of the stream and the maximum required buffer window.
You cannot know what the average bit rate will be for a constrained VBR stream before encoding, but you can use a rough estimate. As a general rule, the maximum bit rate you specify will end up being two to three times the average bit rate.
Constrained 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 use constrained VBR encoding, perform the following steps.
- Create a profile manager object by calling the WMCreateProfileManager function.
- Open an existing profile to which you want to add VBR support. For more information about opening profiles, see Working with Profiles.
- Get a stream configuration object for the stream you want to use by calling either IWMProfile::GetStream or IWMProfile::GetStreamByNumber.
- Get a pointer to the IWMPropertyVault interface of the stream configuration object by calling IWMStreamConfig::QueryInterface.
- Enable VBR encoding for the stream by calling IWMPropertyVault::SetProperty for the g_wszVBREnabled property.
- Use calls to IWMPropertyVault::SetProperty to set the desired maximum values for the g_wszVBRBitrateMax and g_wszVBRBufferWindowMax properties.
- Save the changes made to the stream by calling IWMProfile::ReconfigStream.
- Save the profile, or pass it to the writer object.
- Configure the writer to perform a preprocessing pass.
Related topics