Export (0) Print
Expand All
Expand Minimize

MFFrameRateToAverageTimePerFrame function

Converts a video frame rate into a frame duration.

Syntax


HRESULT MFFrameRateToAverageTimePerFrame(
  _In_   UINT32 unNumerator,
  _In_   UINT32 unDenominator,
  _Out_  UINT64 *punAverageTimePerFrame
);

Parameters

unNumerator [in]

The numerator of the frame rate.

unDenominator [in]

The denominator of the frame rate.

punAverageTimePerFrame [out]

Receives the average duration of a video frame, in 100-nanosecond units.

Return value

If this function succeeds, it returns S_OK. Otherwise, it returns an HRESULT error code.

Remarks

This function is useful for calculating time stamps on a sample, given the frame rate.

Also, average time per frame is used in the older VIDEOINFOHEADER and VIDEOINFOHEADER2 format structures. This function provides a standard conversion so that all components in the pipeline can use consistent values, if they need to translate between the older format structures and the media type attributes used in Media Foundation.

For certain common frame rates, the function gets the frame duration from a look-up table:

Frames per second (floating point)Frames per second (fractional)Average time per frame
59.9460000/1001166833
29.9730000/1001333667
23.97624000/1001417188
6060/1166667
3030/1333333
5050/1200000
2525/1400000
2424/1416667

 

Most video content uses one of the frame rates listed here. For other frame rates, the function calculates the duration.

Requirements

Minimum supported client

Windows Vista [desktop apps only]

Minimum supported server

Windows Server 2008 [desktop apps only]

Header

Mfapi.h

Library

Mfplat.lib

DLL

Mfplat.dll

See also

Media Foundation Functions
MFAverageTimePerFrameToFrameRate
Media Types

 

 

Community Additions

ADD
Show:
© 2014 Microsoft