NVENC - Encode multiple video sequences in a single session?

Hi,

I want to encode multiple video sequences without re-creating an NVENC session, is that possible?
In other words, I want to encode several H264 videos without open and close an encode session for each video.
My video sequences have the same input parameters (framerate, resolution, profile, level etc.).

When I get the last frame of a video sequence, I flush the encoder. The first generated H264 video is correct but the following ones are broken.

Also, I was wondering if it is possible to have several parallel sessions with only 1 GPU?

Thanks.

I found a solution, you need to encode the first frame of each video sequence with:

NV_ENC_PIC_PARAMS::encodePicFlags = NV_ENC_PIC_FLAG_OUTPUT_SPSPPS | NV_ENC_PIC_FLAG_FORCEIDR;