Getting Encoding Statistics

Information about what is happening in an encoding session is generally immediately available in the form of error codes returned when processing samples. However, there are some statistics that you can retrieve from the codec about various encoding aspects.

Video Frame Information

Some video statistics that you can retrieve deal with the number of frames processed by the encoder. There are three frame number properties that you can read from the video encoder:

  • MFPKEY_TOTALFRAMES is the number of frames processed through the input stream of the DMO.
  • MFPKEY_CODEDFRAMES is the number of frames encoded. By subtracting this value from the total number of frames passed, you can determine how many frames were dropped.
  • MFPKEY_ZEROBYTEFRAMES is the number of frames not encoded because they duplicated content already included. This value is not subtracted from the number of coded frames reported by the DMO.

You can read video frame properties at any time during encoding. This can be useful in determining if the encoding settings are appropriate for your content; if there is a large difference between total frames and coded frames, the compressed content might not meet your quality requirements. You can read the final values after you finish encoding.

VBR Buffer Statistics

Depending upon the encoding mode used, some or all of the buffer settings may be determined during encoding (for example, the bit rate of quality based VBR is not known until the content is encoded). There are four VBR buffer properties that you can get using the IPropertyBag::Read method:

After you begin processing samples, you should not read any of the VBR properties until you are finished encoding the stream. If you do, the encoder interprets your request as a signal that the encoding is complete. The next sample that you process is treated as a new encoding session.

Windows Media Codecs