Doesn't work nvv4l2decoder for decoding RTSP in gstreamer + opencv

Hi all,
I want to do decoding multi-stream RTSP using h264 hardware decoder of jetson nano, but When I use nvv4l2decoder for decoding, Doesn’t work, but omxh264dec is work correctly.
I want to use drop-frame-interval options of nvv4l2decoder, but this option isn’t exist in omxh264dec,
my jetson nano system :
cuda 10.0
jetpack 4.2.2
opencv 3.4.6 and cuda support and gstreamer support (build from source)

The below code is work correctly, but when I put nvv4l2decoder instead of omxh264dec, the decoder doesn’t work.

 gstream_elemets = (
                'rtspsrc location=rtsp latency=300 !'
                'rtph264depay ! h264parse !'
                'queue max-size-buffers=10 !'
                'omxh264dec enable-max-performance=1 enable-low-outbuffer=1 !'
                'video/x-raw(memory:NVMM),format=(string)NV12 !'
                'nvvidconv ! video/x-raw  format=(string)BGRx !'
                'queue max-size-buffers=10 !'
                'videoconvert ! '
                'appsink')
cv2.VideoCapture(gstream_elemets, cv2.CAP_GSTREAMER)

I also this work for filesrc but don’t work for rtspsrc, why?

gst_str = ('filesrc location=file_path latency=300 ! '
               'qtdemux   ! h264parse ! nvv4l2decoder  ! '
               'nvvidconv ! '
               'video/x-raw, '
               'format=(string)NV12 ! '
               'videoconvert !'
               'appsink ')
cv2.VideoCapture(gst_str, cv2.CAP_GSTREAMER)

Hi,
We try to launch public RTSP source and it works fine:

import sys
import cv2

def read_cam():
    cap = cv2.VideoCapture("rtspsrc location=rtsp://wowzaec2demo.streamlock.net/vod/mp4:BigBuckBunny_115k.mov ! rtph264depay ! h264parse ! nvv4l2decoder ! nvvidconv ! video/x-raw, format=(string)BGRx ! videoconvert ! video/x-raw,format=BGR ! appsink ")
    if cap.isOpened():
        cv2.namedWindow("demo", cv2.WINDOW_AUTOSIZE)
        while True:
            ret_val, img = cap.read();
            cv2.imshow('demo',img)
            cv2.waitKey(10)
    else:
     print "rtsp open failed"

    cv2.destroyAllWindows()


if __name__ == '__main__':
    read_cam()

FYR.

1 Like

I run your code and it doesn’t show me any things, and stuck in this state:
I set my location = rtsp://IP:PORT/1920x1080.264, and I stream the 1920x1080.264 file with live555 from other system and I want to decode with jetson nano.
this rtsp is work correctly with omxh264dec.

This is with jetpack 4.2.2 :

nvbuf_utils: Could not get EGL display connection
Opening in BLOCKING MODE 
NvMMLiteOpen : Block : BlockType = 261 
NVMEDIA: Reading vendor.tegra.display-size : status: 6 
NvMMLiteBlockCreate : Block : BlockType = 261 

(python3:20431): GStreamer-CRITICAL **: 11:29:19.872: gst_mini_object_unref: assertion 'mini_object != NULL' failed
NvMMLiteOpen : Block : BlockType = 261 
NVMEDIA: Reading vendor.tegra.display-size : status: 6 
NvMMLiteBlockCreate : Block : BlockType = 261

This is with jetpack 4.4 DP:

libEGL warning: DRI2: failed to authenticate
libEGL warning: MESA-LOADER: failed to open swrast (search paths /usr/lib/aarch64-linux-gnu/dri:\$${ORIGIN}/dri:/usr/lib/dri)

libEGL warning: MESA-LOADER: failed to open swrast (search paths /usr/lib/aarch64-linux-gnu/dri:\$${ORIGIN}/dri:/usr/lib/dri)

nvbuf_utils: Could not get EGL display connection
Opening in BLOCKING MODE 
NvMMLiteOpen : Block : BlockType = 261 
NVMEDIA: Reading vendor.tegra.display-size : status: 6 
NvMMLiteBlockCreate : Block : BlockType = 261
1 Like

There is no update from you for a period, assuming this is not an issue any more.
Hence we are closing this topic. If need further support, please open a new one. Thanks

Hi,
Does the public RTSP URI work?

rtsp://wowzaec2demo.streamlock.net/vod/mp4:BigBuckBunny_115k.mov

We don’t see issue in connecting to the URI. Would like to align this result first.

Same issue for me. Nothing.

Here is my pipe:
std::string pipe = "rtspsrc location=rtsp://wowzaec2demo.streamlock.net/vod/mp4:BigBuckBunny_115k.mov ! rtph264depay ! h264parse ! nvv4l2decoder ! nvvidconv ! video/x-raw, format=(string)BGRx ! videoconvert ! video/x-raw,format=BGR ! appsink ";

All I get is “Opening in BLOCKING MODE”
nothing else… until Cntl-C to exit.

It works with omxh264dec.

Still trying to get 264 hardware acceleration on VideoCapture.
Running Xavier NX.

dk@XavierNX:~$ gst-inspect-1.0 nvv4l2decoder
Factory Details:
Rank primary + 11 (267)
Long-name NVIDIA v4l2 video decoder
Klass Codec/Decoder/Video
Description Decode video streams via V4L2 API
Author Nicolas Dufresne nicolas.dufresne@collabora.com, Viranjan Pagar vpagar@nvidia.com

Plugin Details:
Name nvvideo4linux2
Description Nvidia elements for Video 4 Linux
Filename /usr/lib/aarch64-linux-gnu/gstreamer-1.0/libgstnvvideo4linux2.so
Version 1.14.0
License LGPL
Source module nvvideo4linux2
Binary package nvvideo4linux2
Origin URL http://nvidia.com/

GObject
±—GInitiallyUnowned
±—GstObject
±—GstElement
±—GstVideoDecoder
±—GstNvV4l2VideoDec
±—nvv4l2decoder

Any help much appreciated!
Dave

Hi birdingpix,

Please help to open a new topic for your issue. Thanks