Setting ForceIDR causes skip in I-frame interval count

I am running a use case where I am setting the I-frame (and IDR) interval to 30 frames. If I call forceIDR every 45 frames I will see Intra frames on 30 45 61 90 92 122 135 …

I understand from Encoding interval and initial frame for i-frames and IDR that for some reason the internal interval counter does not reset after calling forceIdr (this is a bug in my opinion). but what is not addressed is that calling forceIdr causes the frame interval count to skip the inserted I frame. So instead of the next I-frame occurring at the 30th frame it occurs 31 frames later.

My real use case is that I want to flush the encoder every x frames. Suppose that is every 60 frames. We have implemented after our flush call to force the next frame as IDR as some times we need to guarantee the stream can be “cut”. What is happening is that we end up seeing 2 I-frames back to back.

Requesting that setting forceIDR resets the interval count between I-frames. At the very least it should not be skipping counting the I-frame as a frame in the interval count.

1 Like

Hi,
We suggest disable I frame and see if it meets your requirement. To have only IDR and P frames in the encoded H264 stream.

Hi @DaneLLL ,
I tried disabling I-frames by setting Encoder->setIFrameInterval(-1);. This did not change the output. Is there a different way to “disable I frame” you would like me to try?

Hi,
Please try to disable IDR and I frames. And call forceIDR to insert IDR frames. So that you can have full control of having IDR frames. Please try the solution and see if it meets your requirement.

@DaneLLL Is the correct way to

disable IDR and I frames.

to set the intervals to (-1) ?

Hi,
Yes, please set to -1(4294967295 in uint32) like the command:

01_video_encode$ ./video_encode 720.yuv 1280 720 H264 test2.264 -idri 4294967295 -ifi 4294967295