'rtsp stream in opencv-python

I'd like to read rtsp stream in my python script. To do so, I'm using OpenCV:

import cv2
cap = cv2.VideoCapture("rtsp://name:pwd@addr:port")

After a while, errors pop out

[ WARN:0] global ./modules/videoio/src/cap_gstreamer.cpp (2060) handleMessage OpenCV | GStreamer warning: your GStreamer installation is missing a required plugin
[ WARN:0] global ./modules/videoio/src/cap_gstreamer.cpp (2075) handleMessage OpenCV | GStreamer warning: Embedded video playback halted; module uridecodebin0 reported: No URI handler implemented for "rtsp".
[ WARN:0] global ./modules/videoio/src/cap_gstreamer.cpp (1053) open OpenCV | GStreamer warning: unable to start pipeline
[ WARN:0] global ./modules/videoio/src/cap_gstreamer.cpp (616) isPipelinePlaying OpenCV | GStreamer warning: GStreamer: pipeline have not been created

and then cap.read() always returns None.

I'm not familiar with GStreamer and its plugins, so I didn't manage to google anything meaningful.



Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source