Community
cancel
Showing results for 
Search instead for 
Did you mean: 
Anita_C_
Beginner
32 Views

IMSDK H264 encoder behaviour when IDR is forced

Hi,

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

0 Kudos
1 Reply
Jeffrey_M_Intel1
Employee
32 Views

Hi Anita,

Here are a few things that might help:

  1. When inserting a new IDR frame, drain your pipeline and reset.  There are only a few changes that are completely safe to do without a drain/reset.  Use mfxExtEncoderResetOption=ON to make sure that a new GOP sequence is started.
  2. To ensure that mfxEncodeCtrl parameters correctly correspond to intended frame, allocate as many of them as surfaces used by the encoder.  You can then use the same index for your surfaces and mfxEncodeCtrl parameters -- both can't overlap with other asynchronous work for similar reasons.

Thanks, Jeff