cuvidParseVideoData callbacks are never called

Hi

I’m running the AppTrans application provided in NVenc SDK 8.1.24. I’m able to transcode a file and (with a minimal change in the original code) also and rstp stream, using the provided ffmpeg demuxer.

I have two IP cameras producing one rtsp stream each.

With the first rstp stream everything is fine. I checked the generated file and I can reproduce it without any problem. Although, with the second stream for some reason it does not work.

The cameras have practically the same set up. They are different model but both stream in H264 with the same resolution, frame rate…

What I noticed is that, with the second stream, after calling cuvidParseVideoData, non of the callback functions pfnSequenceCallback, pfnDecodePicture either pfnDisplayPicture, are called even the function returns success.

The problem relies probably on the camera but I wonder if there’s any additional check that cuvidParseVideoData does with the incoming data and the error is not catched. How can I check if, even the function returns success, at some point generates this error?

Thanks

Hi

I found the problem. According to H264 ISO, SPS and PPS packets can be sent every n frames or at the beginning of the stream. Before any frame packet can be parsed with cuvidParseVideoData, SPS packets and PPS packets must be first parsed (I couldn’t found any Nvidia documentation mentioning this).

In my case, the second camera was sending the SPS and PPS packets every 5 frames. Thus, first frames where not encoded but once the encoder receives the SPS and PPS packets, the callback functions started to be called.

In the first stream, SPS and PPS packets where sent just once at the beginning of the rtsp connection. Because of the thread scheduling the first packets where lost and not processed. Consequently, cuvidParseVideoData was receiving all packet frames but it never received the SPS and PPS, thus, it will never call the callback functions.

I change my code so first packets weren’t lost. I parsed those packets through cuvidParseVideoData and the rest of packets frames where parsed and the consequent callback functions were called.

I wonder if, when the second situation happens, the return of the cuvidParseVideoData should be success or another return like SPS_NO_RECEIVED. Or maybe check the internal state of the CUvideoparser. In any case I found this bug really difficult to catch given the lack of tools to check for errors in NVEnc.

Hi nacho.valladares,

I’ve stumbled upon a few other posts that seem to be related to this. Your solution lead me on the correct path to solving this by updating the provided FFmpegDemuxer.

For anyone who finds this my solution is posted here Video Codec SDK: Decoding problem - #5 by sean12