Hi
I am currently trying to change the max key frame interval of the media foundation H.264 encoder by setting the MF_MT_MAX_KEYFRAME_SPACING on the output media type of the encoder. But every video that I create seems to always default to a key frame interval
of 2 seconds.
My current scenario entails setting up a SinkWriter with an uncompressed YUY2 input media type and a H.264 output media type.
The video source is 25fps so for a 1 second key frame interval I set the MF_MT_MAX_KEYFRAME_SPACING attribute on the H.264 output media type to 25 frames. But the H.264 encoder still outputs the key frames every 2 seconds(50 frames).
I also tried setting it to a higher 250 frames(10 second) interval and with the same result.
Am I missing some setting somewhere or is the max key frame interval not configurable on the media foundation H.264 encoder?
I have included two trace statements from my tests with the SinkWriter below:
1. The Media Foundation H.264 encoder being created.
7784,1CD4 12:44:33.39787 COle32ExportDetours::CoCreateInstance @ Created {6CA50344-051A-4DED-9779-A43305165E35} (C:\Windows\SysWOW64\mfh264enc.dll) @00A5B51C - traced interfaces: IMFTransform @00A5B51C,
2. The output media format set on the encoder with the MF_MT_MAX_KEYFRAME_SPACING=25 attribute.
7784,1CD4 12:44:33.41075 CMFTransformDetours::SetOutputType @00A5B51C Succeeded MT: MF_MT_FRAME_SIZE=3092376453696 (720,576);MF_MT_AVG_BITRATE=3500000;MF_MT_MPEG_SEQUENCE_HEADER=00 00 00 01 67 42 c0 1e 95 b0 2d 04 9b 01 10 00 00 03 00 10 00 00 03 03 21 da 08
84 6e 00 00 00 01 68 ca 8f 20 ;MF_MT_MAJOR_TYPE=MEDIATYPE_Video;MF_MT_MPEG2_PROFILE=66;MF_MT_MAX_KEYFRAME_SPACING=25;MF_MT_FRAME_RATE=107374182401 (25,1);MF_MT_PIXEL_ASPECT_RATIO=4294967297 (1,1);MF_MT_INTERLACE_MODE=7;MF_MT_SUBTYPE=MEDIASUBTYPE_H264