NVDEC Gstreamer Element Issue

Hi all,

I’ve recently installed the nvenc, nvdec GST elements following the guides [1, 2] here on Ubuntu 18.04 with a RTX 3080 card, with the latest Video Codec SDK.

gst-inspect-1.0 nvdec
Factory Details:
  Rank                     primary (256)
  Long-name                NVDEC video decoder
  Klass                    Decoder/Video
  Description              NVDEC video decoder
  Author                   Ericsson AB, http://www.ericsson.com

Plugin Details:
  Name                     nvdec
  Description              GStreamer NVDEC plugin
  Filename                 /usr/lib/x86_64-linux-gnu/gstreamer-1.0/libgstnvdec.so
  Version                  1.14.5
  License                  BSD
  Source module            gst-plugins-bad
  Source release date      2019-05-29
  Binary package           GStreamer Bad Plug-ins source release
  Origin URL               Unknown package origin

GObject
 +----GInitiallyUnowned
       +----GstObject
             +----GstElement
                   +----GstVideoDecoder
                         +----GstNvDec

Pad Templates:
  SRC template: 'src'
    Availability: Always
    Capabilities:
      video/x-raw(memory:GLMemory)
                 format: NV12
                  width: [ 1, 2147483647 ]
                 height: [ 1, 2147483647 ]
              framerate: [ 0/1, 2147483647/1 ]
         texture-target: 2D
  
  SINK template: 'sink'
    Availability: Always
    Capabilities:
      video/x-h264
          stream-format: byte-stream
              alignment: au
      video/x-h265
          stream-format: byte-stream
              alignment: au
      video/mpeg
            mpegversion: { (int)1, (int)2, (int)4 }
           systemstream: false
      image/jpeg

Element has no clocking capabilities.
Element has no URI handling capabilities.

Pads:
  SINK: 'sink'
    Pad Template: 'sink'
  SRC: 'src'
    Pad Template: 'src'

Element Properties:
  name                : The name of the object
                        flags: readable, writable
                        String. Default: "nvdec0"
  parent              : The parent of the object
                        flags: readable, writable
                        Object of type "GstObject"

I’m trying to use it to replace avdec_h264 in the working example GST pipeline below, running a test video file:

sudo gst-launch-1.0 filesrc location=test.mp4 ! qtdemux ! h264parse ! avdec_h264 ! autovideosink

sudo gst-launch-1.0 filesrc location=test.mp4 ! qtdemux ! h264parse ! nvdec ! autovideosink

But when I run the pipeline using nvdec, the video sink screen is entirely green, and the following error occurs:

sudo gst-launch-1.0 filesrc location=test.mp4 ! qtdemux ! h264parse ! nvdec ! autovideosink
Setting pipeline to PAUSED ...
error: XDG_RUNTIME_DIR not set in the environment.
Pipeline is PREROLLING ...
Got context from element 'autovideosink0': gst.gl.GLDisplay=context, gst.gl.GLDisplay=(GstGLDisplay)"\(GstGLDisplayX11\)\ gldisplayx11-0";
Redistribute latency...
Pipeline is PREROLLED ...
Setting pipeline to PLAYING ...
New clock: GstSystemClock
Caught SIGSEGV
#0  0x00007f04b88e8cb9 in __GI___poll (fds=0x55a3998a3620, nfds=2, timeout=-1)
#1  0x00007f04b8e306e9 in  () at /usr/lib/x86_64-linux-gnu/libglib-2.0.so.0
#2  0x00007f04b8e30a82 in g_main_loop_run ()
#3  0x00007f04b93949f3 in gst_bus_poll ()
#4  0x000055a397b8cbb3 in  ()
#5  0x000055a397b8bcb7 in  ()
#6  0x00007f04b87f5bf7 in __libc_start_main (main=
#7  0x000055a397b8c0da in  ()
Spinning.  Please run 'gdb gst-launch-1.0 16669' to continue debugging, Ctrl-C to quit, or Ctrl-\ to dump core.

Running nvidia-smi, I do see the process there.

nvidia-smi
Wed Dec  8 02:07:25 2021       
+-----------------------------------------------------------------------------+
| NVIDIA-SMI 470.86       Driver Version: 470.86       CUDA Version: 11.4     |
|-------------------------------+----------------------+----------------------+
| GPU  Name        Persistence-M| Bus-Id        Disp.A | Volatile Uncorr. ECC |
| Fan  Temp  Perf  Pwr:Usage/Cap|         Memory-Usage | GPU-Util  Compute M. |
|                               |                      |               MIG M. |
|===============================+======================+======================|
|   0  NVIDIA GeForce ...  Off  | 00000000:04:00.0 Off |                  N/A |
|  0%   44C    P2   107W / 370W |    235MiB / 10018MiB |      0%      Default |
|                               |                      |                  N/A |
+-------------------------------+----------------------+----------------------+
                                                                               
+-----------------------------------------------------------------------------+
| Processes:                                                                  |
|  GPU   GI   CI        PID   Type   Process name                  GPU Memory |
|        ID   ID                                                   Usage      |
|=============================================================================|
|    0   N/A  N/A      2265      G   /usr/lib/xorg/Xorg                  9MiB |
|    0   N/A  N/A      2813      G   /usr/bin/gnome-shell               10MiB |
|    0   N/A  N/A     14701      C   gst-launch-1.0                    211MiB |
+-----------------------------------------------------------------------------+

If anyone can assist me in getting nvdec working nicely with Gstreamer, that would be much appreciated!

Were You able to solve the problem ?

@kelvin.chan95hk I am getting the same Green Screen.Any Resolution for This.

Hi Kelvin, Green screen means, the nvdec is not able to use GPU, possible reasons could be

  1. secure boot is enabled
  2. incompatible cuda vs driver
  3. incompatable driver
  4. prime-select is poiting to inter iGPU