SEI NAL unit resend each packet on H264

When using H264 encoding on NVENC with latest SDK SEI NAL unit is send each h264 packet.

Output of libx264:

  • first IDR I frame:
    nal_type: 9
    nal_type: 7
    nal_type: 8
    nal_type: 6
    nal_type: 5

  • second B frame
    nal_type: 9
    nal_type: 1

On NVENC:

  • first IDR I frame:
    nal_type: 9
    nal_type: 7
    nal_type: 8
    nal_type: 6
    nal_type: 6 - second one
    nal_type: 5

  • second B frame
    nal_type: 9
    nal_type: 6
    nal_type: 1

h264->outputPictureTimingSEI is set to 1, is there any option to sent SEI NAL only on I/IDR frames?

Please ignore this thread, as libx264 is inserting only USER_DATA_UNREGISTERED but NVENC is inserting BUFFERING_PERIOD and PIC_TIMING

So real problem is that this patch https://lists.ffmpeg.org/pipermail/ffmpeg-cvslog/2017-September/108932.html added SEI for all frames without option to disable it.

Original pourpose of this patch was to add it fo fix some interlaced frame timing issues, but now when NVENC doesn’t support interlaced encoding on new RTX generation it is useles.

Is it possible to add bitstream_restriction_flag to NAL SPS?

This flag should be added to report correct max_num_reorder_frames when using -bref middle, for disabled and each mode max_num_reorder_frames is always 1, but for middle it is 2, which should be reported.

In libx264 bitstream_restriction is 0 only when using profile lower than HIGH or when not using b_constraint_set3, which is used for profile HIGH+INTRA.

Problem is in FFMPEG, it should be defined in vui structure.

vui->bitstreamRestrictionFlag = 1;

Then NVENC will add bitstream_restriction