Writing Variable Bit Rate Streams

[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) streams are written the same way as constant bit rate (CBR) streams. The only difference is in the processing performed internally by the writer and the codecs. However, bit rate based VBR (both constrained and unconstrained) requires a preprocessing pass in the writer.

You should check the return value for the first call you make to IWMWriter::WriteSample for each stream. If the error code returned is NS_E_INVALID_NUM_PASSES, the stream requires a preprocessing pass.

Using Two-Pass Encoding

Writing ASF Files