Gstreamer pipeline input to opencv in python

I try, it work

gst-launch-1.0 rtspsrc location=rtsp://admin:xxxx@10.130.128.xx ! decodebin ! nvvideoconvert ! nvdsosd ! nvegltransform ! nveglglessink

why in python, not work

gst_str = "rtspsrc location=rtsp://admin:xxxx@10.130.128.xx ! decodebin ! nvvideoconvert ! nvdsosd ! nvegltransform ! nveglglessink"
cap = cv2.VideoCapture(gst_str, cv2.CAP_GSTREAMER)
 
while True:
    _, frame = cap.read()
    cv2.imshow('RTSP stream', frame)
  
    if cv2.waitKey(1) == 27:
        break

error

cv2.imshow('RTSP stream', frame)
cv2.error: /build/opencv-XDqSFW/opencv-3.2.0+dfsg/modules/highgui/src/window.cpp:304: error: (-215) size.width>0 && size.height>0 in function imshow

Hi,
The last plugin has to be appsink. It does not work with nveglglessink. Please refer to this sample:
Doesn't work nvv4l2decoder for decoding RTSP in gstreamer + opencv - #3 by DaneLLL

I try to follow the example

same error

cv2.error: /build/opencv-XDqSFW/opencv-3.2.0+dfsg/modules/highgui/src/window.cpp:304: error: (-215) size.width>0 && size.height>0 in function imshow

try open rtsp “rtsp://wowzaec2demo.streamlock.net/vod/mp4:BigBuckBunny_115k.mov” ,it work
T-T

Hi,
So this does not work:

rtspsrc location=rtsp://admin:xxxx@10.130.128.xx ! rtph264depay ! h264parse ! nvv4l2decoder ! nvvidconv ! video/x-raw, format=(string)BGRx ! videoconvert ! video/x-raw,format=BGR ! appsink 

Please try gst-launch-1.0 command to make sure URI is valid:

gst-launch-1.0 rtspsrc location=rtsp://admin:xxxx@10.130.128.xx ! rtph264depay ! h264parse ! nvv4l2decoder ! nvvidconv ! video/x-raw, format=(string)BGRx ! videoconvert ! video/x-raw,format=BGR ! fakesink

Hi, DaneLLL
I don’t mean that.
I’m using the sorce “rtsp://wowzaec2demo.streamlock.net/vod/mp4:BigBuckBunny_115k.mov” from the example, but same error

I try run :

gst-launch-1.0 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 ! fakesink

Result: No response at…

Setting pipeline to PAUSED ...
Opening in BLOCKING MODE 
Pipeline is live and does not need PREROLL ...
Progress: (open) Opening Stream
Progress: (connect) Connecting to rtsp://wowzaec2demo.streamlock.net/vod/mp4:BigBuckBunny_115k.mov
Progress: (open) Retrieving server options
Progress: (open) Retrieving media info
Progress: (request) SETUP stream 0
Progress: (request) SETUP stream 1
Progress: (open) Opened Stream
Setting pipeline to PLAYING ...
New clock: GstSystemClock
Progress: (request) Sending PLAY request
Progress: (request) Sending PLAY request
Progress: (request) Sent PLAY request
NvMMLiteOpen : Block : BlockType = 261 
NVMEDIA: Reading vendor.tegra.display-size : status: 6 
NvMMLiteBlockCreate : Block : BlockType = 261 
NvMMLiteOpen : Block : BlockType = 261 
NVMEDIA: Reading vendor.tegra.display-size : status: 6 
NvMMLiteBlockCreate : Block : BlockType = 261

Sorry for the late response, have you managed to get issue resolved or still need the support? Thanks

Hi,
You may also try this:
I got the RTSP video stream on the jetson nano and ran it for about 50 frames before returning false - #7 by DaneLLL

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.