I encounter some error using nvidia+gstreamer to play video

when i complie gstreamer+nvidia to decode video,which generating some error.please assist me to analyze this problem
my computer env:
RTX3060
ubuntu 20.04
cuda 12.2
cudnn 11.3
NVIDIA-SMI 535.146.02
tensorRT 8.6
gst-inspect-1.0 version 1.16.3
GStreamer 1.16.3
Video_Codec_SDK_12.1.14

the complie step:
ubuntu@ubuntu:~$ sudo apt-get install libgstreamer1.0-dev libgstreamer-plugins-base1.0-dev libgstreamer-plugins-bad1.0-dev gstreamer1.0-plugins-base gstreamer1.0-plugins-good gstreamer1.0-plugins-bad gstreamer1.0-plugins-ugly gstreamer1.0-libav gstreamer1.0-tools gstreamer1.0-x gstreamer1.0-alsa gstreamer1.0-gl gstreamer1.0-gtk3 gstreamer1.0-qt5 gstreamer1.0-pulseaudio

ubuntu@ubuntu:~$ git clone -b 1.16 GStreamer / gst-plugins-bad · GitLab
Cloning into ‘gst-plugins-bad’…
remote: Enumerating objects: 227254, done.
remote: Counting objects: 100% (55/55), done.
remote: Compressing objects: 100% (34/34), done.
remote: Total 227254 (delta 21), reused 55 (delta 21), pack-reused 227199
Receiving objects: 100% (227254/227254), 51.58

ubuntu@ubuntu:~$ cd gst-plugins-bad
ubuntu@ubuntu:~/gst-plugins-bad$ ./autogen.sh
ubuntu@ubuntu:~/gst-plugins-bad$ NVENCODE_LIBS=“-L/usr/local/cuda/lib64/stubs” NVENCODE_CFLAGS=“-I/usr/local/cuda/include” ./configure --enable-nvdec --enable-nvenc --enable-openh264 --with-cuda-prefix=“/usr/local/cuda-11.1”
//decoder
ubuntu@ubuntu:~/gst-plugins-bad$ cd sys/nvdec
ubuntu@ubuntu:~/gst-plugins-bad$ sudo make install
//encoder
ubuntu@ubuntu:~/gst-plugins-bad$ cd sys/nvenc
ubuntu@ubuntu:~/gst-plugins-bad$ sudo make install

ubuntu@ubuntu:~/gst-plugins-bad$ echo export GST_PLUGIN_PATH=“/usr/local/lib/gstreamer-1.0” >> ~/.bashrc
ubuntu@ubuntu:~/gst-plugins-bad$ source ~/.bashrc

when i test gstreamer nvdec or nvenc successfully
ubuntu@ubuntu:~/gst-plugins-bad/sys$ gst-inspect-1.0 nvdec
ubuntu@ubuntu:~/gst-plugins-bad/sys$ gst-inspect-1.0 nvh264enc


when i run the command, i encounter some error
ubuntu@ubuntu:~$ GST_DEBUG=3 gst-launch-1.0 filesrc location=/home/ubuntu/cup.mp4 ! qtdemux ! queue ! h264parse ! nvdec ! glimagesink sync=false
0:00:00.564334327 34835 0x55a93ac05f00 WARN nvdec gstnvdec.c:58:cuda_OK: CUDA call failed: CUDA_ERROR_INVALID_HANDLE, invalid resource handle
0:00:00.564346097 34835 0x55a93ac05f00 WARN nvdec gstnvdec.c:600:copy_video_frame_to_gl_textures: failed to map CUDA resources
0:00:00.568327158 34835 0x55a93ac05f00 WARN nvdec gstnvdec.c:58:cuda_OK: CUDA call failed: CUDA_ERROR_INVALID_HANDLE, invalid resource handle
0:00:00.568333197 34835 0x55a93ac05f00 WARN nvdec gstnvdec.c:600:copy_video_frame_to_gl_textures: failed to map CUDA resources
0:00:00.569587288 34835 0x55a93ac05f00 WARN nvdec gstnvdec.c:58:cuda_OK: CUDA call failed: CUDA_ERROR_INVALID_HANDLE, invalid resource handle

i have find some question in this party : Nvidia Gstreamer plugins (nvenc, nvdec) decode H265 video error

Do you have more than one Cuda Toolkit installed? In the above, your incudes are pointed to /usr/local/cuda and your prefix is /usr/local/cuda-11.1.

/usr/local/cuda is a symlink to the active toolkit.

ubuntu@ubuntu:~$ ls /usr/local/
bin cuda cuda-11.1 etc games include lib man sbin share src sunlogin

i only install one cuda, but i also try it
ubuntu@ubuntu:~/gst-plugins-bad$ NVENCODE_LIBS=“-L/usr/local/cuda/lib64/stubs” NVENCODE_CFLAGS=“-I/usr/local/cuda/include” ./configure --enable-nvdec --enable-nvenc --enable-openh264 --with-cuda-prefix=“/usr/local/cuda”
i still encounter common error!

Have you tried the current version of gst-plugins-bad?

I ask, as the link you cloned from has a note at the top:
" This code has been moved to the GStreamer mono repo, please submit new issues and merge requests there!"
and seems to have not moved for a couple of years.

The current version seems to be here.

when i have locally installed GStreamer 1.16.3, i should also use GStreamer Bad plugins version 1.16.3 instead of the latest version. Using mismatched versions of GStreamer and its plugins can lead to compatibility issues and unexpected behavior. It’s important to ensure that all components of your GStreamer setup are aligned with the same version to maintain stability and compatibility. Is my understanding incorrect? Should I use the latest version of GStreamer Bad plugins?

Sorry, I have no idea. I’m just offering suggestions. I don’t use gstreamer.

ok thanks,but i can try it
非常感谢您的回复我可以试试

Hi any updates on whether you have solved the issue?
I get the same error message when using nvdec:
0:00:02.149413905 149127 0x55d305df9b00 WARN nvdec gstnvdec.c:600:copy_video_frame_to_gl_textures: failed to map CUDA resources
0:00:02.151993276 149127 0x55d305df9b00 WARN nvdec gstnvdec.c:58:cuda_OK: CUDA call failed: CUDA_ERROR_INVALID_HANDLE, invalid resource handle

But when I use nvenc it is working okay.