Video Stabilization MFT
The video stabilization MFT is a Microsoft Media Foundation transform (MFT) that performs image stabilization on a video stream.
The input media type and sub-type combinations accepted by the video stabilization MFT for uncompressed video are:
The output media type and sub-type combinations accepted by the video stabilization MFT are:
The input media type must be set before the output media type. In most situations, the limited format support is not an issue because the pipeline automatically inserts the necessary color conversions.
The video stabilization MFT component is capable of dynamic format change when input changes. When the input picture size changes or the subtype changes, it will trigger a dynamic format change on the output stream.
The video stabilization MFT will do color conversion in the following cases:
- When the input format is MEDIASUBTYPE_YUY2.
- When Microsoft DirectX 9.0 compatibility mode is used.
The following attributes are supported by the video stabilization MFT through the IMFAttributes interface.
- The attribute MF_VIDEODSP_MODE puts the video stabilization MFT into either stabilization mode or pass-through mode. The application should call IMFAttributes::SetUINT32 on the GUID MF_VIDEODSP_TYPE with an integer corresponding to one of the following valid values: MFVideoDSPMode_Stabilization = 4, MFVideoDSPMode_Passthrough = 1. MF_VIDEODSP_MODE can be changed at any time during playback. This causes a dynamic mode change. The output will switch to either stabilized or pass through after either 16 or 2 frames (depending on the latency mode) after the attribute is changed.
- The attribute MF_LOW_LATENCY puts the video stabilization MFT into either low latency mode or high quality mode. The application should call IMFAttributes::SetUINT32 on the GUID MF_LOW_LATENCY with an integer corresponding to one of the following valid values: Low latency = 1 High Quality = 0
- The attribute MF_SA_D3D11_BINDFLAGS is used by the pipeline to specify the D3D11 bind flags to create the output samples with. Any combination of values from the D3D11_BIND_FLAG enumeration is valid.
- The attribute MF_SA_MINIMUM_OUTPUT_SAMPLE_COUNT is used by the pipeline to specify the minimum number of samples that this component must support on output.
- The attribute MFSampleExtension_VideoDSPMode is set on every sample produced by stabilization to indicate the effective MF_VIDEODSP_MODE applied to that sample (whether or not the sample was stabilized). Under certain conditions, samples may not be stabilized (due to high system load, or requests by the user). This attribute has the same values as the MF_VIDEODSP_MODE attribute (MFVideoDSPMode_Stabilization and MFVideoDSPMode_Passthrough). To get the value of this attribute applications should call IMFAttributes::SetUINT32 on GUID MFSampleExtension_VideoDSPMode.
An instance of the video stabilization DSP can be created in one of the following ways:
- By calling MFTEnumEx. The video stabilization DSP is registered under the MFT_CATEGORY_VIDEO_EFFECT category.
- By calling the COM function CoCreateInstance passing it the CLSID CLSID_CMSVideoDSPMFT. To use this method, you must include wmcodecdsp.h and link against wmcodecdspuuid.lib.
Additionally, the video stabilization DSP supports instantiation using Windows Runtime as a Windows Media Extension. It is defined on the Windows.Media.VideoEffects, and its full name is "Windows.Media.VideoEffects.VideoStabilization".