Let us take below frame sequence and timestamps to understand the behaviour of encoder when we force key frame generation.
Suppose we provide Raw frames F1 F2 F3 F4 F5 F6 with timestamps T1 T2 T3 T4 T5 T6 in that order and we force the F4 as key frame by setting FrameType in mfxEncodeCtrl structure to the value "MFX_FRAMETYPE_I | MFX_FRAMETYPE_REF | MFX_FRAMETYPE_IDR"(as explained in the Forced Key Frame Generation section at the link). Our observation is that encoder gives frames F2 F3 in the output after frame F4. Is it expected behaviour ? How can we force the encoder to give F2 F3 before F4 ? Is this behaviour related to GopOptFlag ?
Please note that encoder works in display order.
Thanks and regards, Anita
Here are a few things that might help: