How can i make h264 P frame contain PPS header

Hi,
When i use intel h264_qsv,the PPS header is contained by every P frame.But it is only contained by IDR frame, when i use nvenc.How can i make the P frame contain the PPS heeader?

pic_params.encodePicFlags = NV_ENC_PIC_FLAG_OUTPUT_SPSPPS;

I already setted the NV_ENC_PIC_FLAG_OUTPUT_SPSPPS parameter.I wonder if i miss some other parameter or need do some special operation for processing output bitstream?

qsv https://flic.kr/p/2bX6C1h
nvenc https://flic.kr/p/2bEv35B

Codec SDK 8.1
Quadro K4200
windows10

I am not sure that PPS header with P-frames have any sense. Decoder can be restarted from IDR-frame (for example dynamically with NV_ENC_PIC_FLAG_OUTPUT_SPSPPS | NV_ENC_PIC_FLAG_FORCEIDR).
If you insist on your scenario you can call NvEncGetSequenceParams() and insert SPSPPS in stream everywhere you need it.
http://developer.nvidia.com/nvenc-programming-guide → “RETRIEVING SEQUENCE PARAMETERS”
http://developer.download.nvidia.com/designworks/capture-sdk/docs/7.1/NVIDIA-Capture-SDK-FAQ.pdf → check also hint “23 - When streaming an H.264 bitstream, what are some of the methods I can use to recover from channel errors and lost frames on the decoder” from Capture SDK

Thx

Thx

Thanks for your reply, now i know what i should do from your answer.

NV_ENC_PIC_FLAG_OUTPUT_SPSPPS      = 0x4,   /**< Write the sequence and picture header in encoded bitstream of the current picture */

The note in SDK indicates that the encoder will write a PIC header for current picture, but it doesn’t, right?

As you can test it SPSPPS does not output until NV_ENC_PIC_FLAG_FORCEIDR is also present.

uint32_t repeatSPSPPS              :1;                          /**< [in]: Set to 1 to enable writing of Sequence and Picture parameter for every IDR frame */

The parameter of repeatSPSPPS can make PPS attached to IDR frame already. If we really need to dynamically generate this header, then should also deploy to all frame which use this parameter, instead of only for IDR frame. In this way, i think this would be a parameter or comment that can mislead users.