Media (Intel® Video Processing Library, Intel Media SDK)
Access community support with transcoding, decoding, and encoding in applications using media tools like Intel® oneAPI Video Processing Library and Intel® Media SDK
Announcements
The Intel Media SDK project is no longer active. For continued support and access to new features, Intel Media SDK users are encouraged to read the transition guide on upgrading from Intel® Media SDK to Intel® Video Processing Library (VPL), and to move to VPL as soon as possible.
For more information, see the VPL website.

IMSDK H264 encoder behaviour when IDR is forced

Anita_C_
Beginner
369 Views

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
369 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

0 Kudos
Reply