H.264 Video Decoder

The Media Foundation H.264 video decoder is a Media Foundation Transform that supports decoding of Baseline, Main, and High profiles, up to level 5.1.

The H.264 video decoder exposes the following interfaces.

To create an instance of the decoder, do one of the following:

Input Types

The input type must contain at least the following two attributes:

Attribute Description
MF_MT_MAJOR_TYPE MFMediaType_Video
MF_MT_SUBTYPE MFVideoFormat_H264 or MFVideoFormat_H264_ES

 

If the input type contains only these two attributes, the decoder will offer a default output type, which acts as a placeholder. When the decoder receives enough input samples to produce an output frame, it signals a format change by returning MF_E_TRANSFORM_STREAM_CHANGE from IMFTransform::ProcessOutput. See the ProcessOutput documentation for details about handling format changes.

To avoid an initial format change, provide as much information in the input type as possible, including:

Attribute Description
MF_MT_FRAME_RATE Frame rate.
MF_MT_FRAME_SIZE Frame dimensions.
MF_MT_INTERLACE_MODE Interlace mode.
[!Note]
In H.264 video, the interlace structure can change dynamically, so the recommended value of this attribute is MFVideoInterlace_MixedInterlaceOrProgressive. Interlace information in the video elementary stream takes precedence over the media type. For more information, see Video Interlacing.


MF_MT_PIXEL_ASPECT_RATIO Pixel aspect ratio.

 

The input type must be set before the output type. Until the input type is set, the encoder's IMFTransform::SetOutputType method returns MF_E_TRANSFORM_TYPE_NOT_SET.

Output Types

The decoder supports the following output subtypes:

  • MFVideoFormat_I420
  • MFVideoFormat_IYUV
  • MFVideoFormat_NV12
  • MFVideoFormat_YUY2
  • MFVideoFormat_YV12

For more information about these subtypes, see Video Subtype GUIDs.

Transform Attributes

The H.264 decoder implements the IMFTransform::GetAttributes method. Applications can use this method to get or set the following attributes.

Attribute Description
CODECAPI_AVDecVideoAcceleration_H264 Enables or disables hardware acceleration.
CODECAPI_AVDecVideoThumbnailGenerationMode Enables or disables thumbnail generation mode.
MF_SA_D3D_AWARE Indicates that the decoder supports DirectX Video Acceleration (DXVA). Treat as read-only.

 

In Windows 8, the H.264 decoder also supports the following attributes.

Attribute Description
CODECAPI_AVLowLatencyMode Enables or disables low-latency decoding mode.
CODECAPI_AVDecNumWorkerThreads Sets the number of worker threads used by the decoder.
CODECAPI_AVDecVideoMaxCodedWidth Sets the maximum picture width that the decoder will accept as an input type.
CODECAPI_AVDecVideoMaxCodedHeight Sets the maximum picture height that the decoder will accept as an input type.
MF_SA_MINIMUM_OUTPUT_SAMPLE_COUNT Specifies the maximum number of output samples.
MFT_DECODER_EXPOSE_OUTPUT_TYPES_IN_NATIVE_ORDER Specifies whether a decoder exposes IYUV/I420 output types (suitable for transcoding) before other formats.

 

In Windows 8, the H.264 decoder supports the ICodecAPI interface. This interface provides an alternativate API for setting the following codec properties.

Format Constraints

The decoder supports the following formats:

Profiles/Levels Baseline, Main, and High profiles, up to level 5.1. (See ITU-T H.264 specification for details.)
Chroma Formats 4:2:0 chroma or monochrome
Minimum Resolution 48 × 48 pixels
Maximum Resolution 4096 × 2304 pixels
The maximum guaranteed resolution for DXVA acceleration is 1920 × 1088 pixels; at higher resolutions, decoding is done with DXVA, if it is supported by the underlying hardware, otherwise, decoding is done with software.
[!Note]
In Windows 7, the maximum supported resolution is 1920 × 1088 pixels for both software and DXVA decoding.


DXVA The decoder supports DXVA version 2, but not DXVA version 1. DXVA decoding is supported only for Main-compatible Baseline, Main, and High profile bitstreams. (Main-compatible Baseline bitstreams are defined as profile_idc=66 and constrained_set1_flag=1.)

 

Input data must conform to Annex B of ISO/IEC 14496-10. The data must include the start codes. The decoder skips bytes until it finds a valid sequence parameter set (SPS) and picture parameter set (PPS) in the byte stream.

The decoder does not support Film Grain Technology.

Note

A previous version of the documentation incorrectly stated that the decoder is supported on Windows Server 2008 R2.

 

If Platform Update Supplement for Windows Vista is installed, the H.264 video decoder is available on Windows Vista, but is accessible on Windows Vista only by using the Source Reader.

Requirements

Minimum supported client
Windows 7 [desktop apps only]
Minimum supported server
None supported
DLL
Msmpeg2vdec.dll

See also

Codec Objects

MPEG-4 Support in Media Foundation

Supported Media Formats in Media Foundation

Video Media Types