H.265 / HEVC Video Encoder
The Media Foundation H.265 video encoder is a Media Foundation Transform that supports encoding content into the H.265/HEVC format. The encoder supports the following profiles:
- Main Profile
The H.265 video encoder exposes the following interfaces:
Input Types
The input media type must have one of the following subtypes:
- MFVideoFormat_IYUV
- MFVideoFormat_NV12
- MFVideoFormat_YUY2
- MFVideoFormat_YV12
For more information about these subtypes, see Video Subtype GUIDs.
The output type must be set before the input type. Until the output type is set, the encoder's IMFTransform::SetInputType method returns MF_E_TRANSFORM_TYPE_NOT_SET.
Output Types
The encoder supports a single output subtype:
- MFVideoFormat_H265
Set the following attributes on the output media type.
Attribute | Description |
---|---|
MF_MT_MAJOR_TYPE | Major type. Must be MFMediaType_Video. |
MF_MT_SUBTYPE | Video subtype. Must be MFVideoFormat_HEVC. |
MF_MT_AVG_BITRATE | Average encoded bit rate, in bits per second. Must be greater than zero. |
MF_MT_FRAME_RATE | Frame rate. |
MF_MT_FRAME_SIZE | Frame size. |
MF_MT_INTERLACE_MODE | Interlace mode. |
MF_MT_VIDEO_PROFILE | H.265 encoding profile. The supported values are:
|
MF_MT_MPEG2_LEVEL | Specifies the level of the coded video. For more information about profile and level constraints, refer to Annex A of ITU-T H.265. |
MF_MT_PIXEL_ASPECT_RATIO | Optional. Specifies the pixel aspect ratio. The default value is 1:1. |
After the output type is set, the video encoder updates the type by adding the MF_MT_MPEG_SEQUENCE_HEADER attribute. This attribute contains the sequence header.
Supported IMFTransform methods
The following methods of the IMFTransform interface are supported for the H.265/HEVC encoder:
- GetAttributes
- GetInputAvailableType
- GetInputCurrentType
- GetInputStatus
- GetInputStreamInfo
- GetOutputAvailableType
- GetOutputCurrentType
- GetOutputStatus
- GetOutputStreamInfo
- GetStreamCount
- GetStreamLimits
- ProcessEvent
- ProcessMessage
- ProcessInput
- ProcessOutput
- SetInputType
- SetOutputType
- SetOutputBounds
All other IMFTransform methods will return the error E_NOTIMPL.
Supported ICodecAPI methods
The following methods of the ICodecAPI interface are supported for the H.265/HEVC encoder:
All other ICodecAPI methods will return the error E_NOTIMPL.
Codec Properties
The H.265 encoder implements the ICodecAPI interface for setting encoding parameters. It supports the following properties.
For the codec requirements for HCK encoder certification, see the Certified Hardware Encoder section below.
Property | Description |
---|---|
CODECAPI_AVEncCommonRateControlMode | Sets the rate control mode. The supported modes are:
This is a VT_UI4 value. |
CODECAPI_AVEncCommonMeanBitRate | Sets the average bit rate for the encoded bit stream, in bits per second. The valid range is [1 ... 2³²–1]. This is a VT_UI4 value. |
CODECAPI_AVEncCommonBufferSize | Sets the buffer size, in bytes, for constant bit rate (CBR) encoding. The valid range is [1 ... 2³²–1]. This is a VT_UI4 value. |
CODECAPI_AVEncCommonMaxBitRate | Sets the maximum bitrate for rate control modes that allow a peak bitrate. The valid range is [1 ... 2³²–1]. This is a VT_UI4 value. |
CODECAPI_AVEncMPVGOPSize | Sets the number of pictures from one GOP header to the next, including the leading anchor but not the following one. The valid range is [0 ... 2³²–1]. If zero, the encoder selects the GOP size. The default value is zero. This is a VT_UI4 value. |
CODECAPI_AVLowLatencyMode | Enables or disables low-latency mode. This is a VT_BOOL value. |
CODECAPI_AVEncCommonQualityVsSpeed | Sets the quality/speed tradeoff. This value affects how the encoder performs various encoding operations, such as motion compensation. At higher complexity levels, the encoder runs more slowly but produces better quality at the same bit rate. The valid range is 0 – 100. Internally, this value is mapped to a smaller set of quality/speed levels supported by the encoder. This is a VT_UI4 value. |
CODECAPI_AVEncVideoForceKeyFrame | Forces the encoder to code the next frame as a key frame. This is a VT_UI4 value. |
CODECAPI_AVEncVideoEncodeQP | When this property is set it will cause the encoder to use the specified QP to encode the next frame and all subsequent frames until a new QP is specified. Valid range: 0–51, inclusive |
CODECAPI_AVEncVideoMinQP | This property will set a limit on the minimum QP that the encoder can use during CBR ratecontrol. This is a VT_UI4 value. |
CODECAPI_AVEncVideoMaxQP | This property will set a limit on the maximum QP that the encoder can use during CBR ratecontrol. This is a VT_UI4 value. |
CODECAPI_VideoEncoderDisplayContentType | Sets whether the content is full-screen video, as opposed to screen content that might have a smaller window of video or have no video at all. This is a VT_UI4 value. |
CODECAPI_AVEncNumWorkerThreads | Sets the number of threads used to perform the compression operation. The encoder will divide the frame into tiles such that the number of threads equals the number of tiles.
|
Certified Hardware Encoder
If a certified hardware encoder is present, it will generally be used instead of the inbox system encoder for Media Foundation related scenarios. Certified encoders are required to support a certain set of ICodecAPI properties and can optionally support another set of properties. The certification process should guarantee that the required properties are properly supported and, if an optional property is supported, that it is also properly supported.
The following is the set of required and optional ICodecAPI properties for encoders to pass the HCK encoder certification.
- CODECAPI_AVEncCommonRateControlMode
- CODECAPI_AVEncCommonQuality
- CODECAPI_AVEncCommonMeanBitRate
- CODECAPI_AVEncCommonBufferSize
- CODECAPI_AVEncMPVGOPSize
- CODECAPI_AVEncVideoEncodeQP
- CODECAPI_AVEncVideoForceKeyFrame
Requirements
Requirement | Value |
---|---|
Minimum supported client |
Windows 10 [desktop apps only] |
Minimum supported server |
None supported |
DLL |
|
See also