Using Two-Pass Encoding

Two-pass encoding can be used for constant bit rate (CBR) and for variable bit rate (VBR) encoding with some of the Windows Media codecs. You can find the maximum number of encoding passes supported by a codec by retrieving the MFPKEY_PASSESRECOMMENDED property. None of the codecs supports more than two passes. Configure the DMO to use two passes by setting the MFPKEY_PASSESUSED property to 2.

Deliver the samples to the encoder DMO one at a time, as you would in a one-pass mode. When you process the input samples for your preprocessing pass, the calls to IMediaObject::ProcessInput or IMFTransform::ProcessInput will return S_FALSE, to indicate that no output is produced.

At the end of the first pass (after the last input is processed for the first time), you then must set the MFPKEY_ENDOFPASS property to notify the codec that the next input processed is the first input of the second pass. No value is required for this property, so you should use an empty VARIANT structure.

Related topics

Windows Media Codecs