MF_MT_FRAME_RATE attribute

Frame rate of a video media type, in frames per second.

Data type

UINT64

Remarks

The frame rate is expressed as a ratio. The upper 32 bits of the attribute value contain the numerator and the lower 32 bits contain the denominator. For example, if the frame rate is 30 frames per second (fps), the ratio is 30/1. If the frame rate is 29.97 fps, the ratio is 30,000/1001.

To set the value, use the MFSetAttributeRatio function. To get the value, use the MFGetAttributeRatio function.

The GUID constant for this attribute is exported from mfuuid.lib.

Examples

The following example sets the frame rate on a video media type.

// Helper function to set the frame rate on a video media type.
inline HRESULT SetFrameRate(
    IMFMediaType *pType, 
    UINT32 numerator, 
    UINT32 denominator
    )
{
    return MFSetAttributeRatio(
        pType, 
        MF_MT_FRAME_RATE, 
        numerator, 
        denominator
        );
}

The following example gets the frame rate from a video media type.

// Helper function to get the frame rate from a video media type.
inline HRESULT GetFrameRate(
    IMFMediaType *pType, 
    UINT32 *pNumerator, 
    UINT32 *pDenominator
    )
{
    return MFGetAttributeRatio(
        pType, 
        MF_MT_FRAME_RATE, 
        pNumerator, 
        pDenominator
        );
}

Requirements

Requirement Value
Minimum supported client
Windows Vista [desktop apps | UWP apps]
Minimum supported server
Windows Server 2008 [desktop apps | UWP apps]
Header
Mfapi.h

See also

Alphabetical List of Media Foundation Attributes

IMFMediaType

Media Type Attributes

MFAverageTimePerFrameToFrameRate

MFFrameRateToAverageTimePerFrame