Hello,
We have installed DeepStream version 5.1 and using it with Python 3.6.9 and Opencv 4.3.0. We have built this OpenCV with gstreamer locally.
The RTSP URI is as follows:
uri = f"rtspsrc location=rtsp://admin:admin12345@192.168.0.103/live ! decodebin ! nvvideoconvert ! appsink"
cap = cv2.VideoCapture(uri, cv2.CAP_GSTREAMER)
When we get a frame from this cap object as follows:
ret, frame = cap.read()
We observed that this frame is grayscale, i.e., the shape is (1080,1920) and is not an RGB image.
We tested with following pipeline:
uri = f"rtspsrc location=rtsp://admin:admin12345@192.168.0.103/live latency=0 ! queue ! rtph264depay ! h264parse ! nvv4l2decoder ! nvvideoconvert ! video/x-raw, width={frame_width}, height={frame_height}, format=RGB ! appsink"
However, this is giving an error:
0:00:00.040978788 24568 0x1343190 ERROR GST_PIPELINE
grammar.y:721:gst_parse_perform_link: could not link nvvideoconvert0 to appsink0, nvvideoconvert0 can't handle caps video/x-raw, width=(int)1280, height=(int)720, format=(string)RGB
[ WARN:0] global /home/vast/opencv-4.3/opencv/modules/videoio/src/cap_gstreamer.cpp (713) open OpenCV | GStreamer warning: Error opening bin: could not link nvvideoconvert0 to appsink0, nvvideoconvert0 can't handle caps video/x-raw, width=(int)1280, height=(int)720, format=(string)RGB
[ WARN:0] global /home/vast/opencv-4.3/opencv/modules/videoio/src/cap_gstreamer.cpp (480) isPipelinePlaying OpenCV | GStreamer warning: GStreamer: pipeline have not been created
We also tested with some variations:
uri = f"rtspsrc location=rtsp://admin:admin12345@192.168.0.103/live latency=0 ! queue ! rtph264depay ! h264parse ! nvv4l2decoder ! nvvideoconvert ! video/x-raw(memory:NVMM), width={frame_width}, height={frame_height}, format=(string)RGBA ! appsink"
And these did not help as well. Could you please provide any suggestions?
The following is from opencv build information:
Video I/O:
DC1394: YES (2.2.5)
FFMPEG: YES
avcodec: YES (57.107.100)
avformat: YES (57.83.100)
avutil: YES (55.78.100)
swscale: YES (4.8.100)
avresample: YES (3.7.0)
GStreamer: YES (1.14.5)
v4l/v4l2: YES (linux/videodev2.h)
Please help.