decode h264 with NVCUVID and GStreamer

Hello all,

I am trying to decode a H264 rtsp stream expoiting NVCUVID via GStreamer. My GPU card is NVIDA RTX 2080.

I ultimately need to decode frames and have access to raw rgb data form CPU for further image processing.

I built Gstreamer 1.16 with Cerbero since the nvdec plugin is not available on my stock distro (Ubuntu 18.04 LTS)

The best pipeline that I managed to put toghether is:

gst-launch-1.0 rtspsrc location="rtsp://root:root@" protocols=GST_RTSP_LOWER_TRANS_TCP latency=0 ! rtph264depay ! h264parse ! nvdec ! gldownload ! fpsdisplaysink sync=false

The problem: this pipeline shows only completely green frames but the fps counter increases, the framerate is consistent with the camera fps and nvidia-smi shows that the process is using some gpu memory.

Anyone has an idea about how to fix it?