Force I-Frame / Ensure GOP structure

Hi Nvidia,

Hope you are doing well. I am new to video encoding and am investigating a frame drop problem that I think has to do with group of pictures structure. If I have encoded frames with I frames, P frames, and B frames. If I do not end on an I-frame, will the B frames before it not be written to disk? Additionally, if I want to write exactly N frames, how do I ensure the Nth frame will be an I-frame so that I may write exactly N frames?


It is advanced controls and a bit complext. We have the options in 01_video_encode:

-rpc <string>         Change configurable parameters at runtime

Runtime configurable parameter string should be of the form:
e.g. "f20,b8000000,i1#f300,b6000000,r40/1"

Property ids:
        b<bitrate>  Bitrate
        p<peak_bitrate>  Peak Bitrate
        r<num/den>  Framerate
        i1          Force I-frame

Please try the options. Would be great if these can meet your requirement. If it does not run as your expectation, you may share us the command to reproduce the issue and explain what the expected behavior is. We can then check with video teams.

If you want to force an I frame, force an IDR frame instead. If you are having trouble decoding the video afterwards, enabled SpsPps at each IDR frame during encoder setup.

  1. Force an IDR frame: nv_encoder->forceIDR()
    2 (optional). Enable SpsPps at each IDR frame during setup: nv_encoder->setInsertSpsPpsAtIdrEnabled(true);