Skip to content

Instantly share code, notes, and snippets.

@gagregrog
Last active April 10, 2024 04:02
Show Gist options
  • Save gagregrog/8bdcf04ec5051ebc75af5f3dcccdf5e8 to your computer and use it in GitHub Desktop.
Save gagregrog/8bdcf04ec5051ebc75af5f3dcccdf5e8 to your computer and use it in GitHub Desktop.
View an RTSP stream in python with OpenCV
import cv2
import imutils
from imutils.video import VideoStream
# replace this with the url generated by the Wyze app
rtsp_url = "rtsp://<camera_name>:<some_uuid>@<some_ip>/live"
vs = VideoStream(rtsp_url).start()
while True:
frame = vs.read()
if frame is None:
continue
frame = imutils.resize(frame, width=1200)
cv2.imshow('WyzeCam', frame)
key = cv2.waitKey(1) & 0xFF
if key == ord('q'):
break
cv2.destroyAllWindows()
vs.stop()
@pteran2403
Copy link

Hi, I am reading a rstp stream using your code and it works fine but I keep getting the following warning.

[rtsp @ 00000207f9a02d40] Missing packets; dropping frame.
[rtsp @ 00000207f9a02d40] Missing packets; dropping frame.
[rtsp @ 00000207f9a02d40] Missing packets; dropping frame.

Any ideas why?

@landolabrum
Copy link

thank you soo much

@Lulhoangminh
Copy link

@pteran2403 Did you find any solution for that problem? I encountered the same problem as yours and I couldn't find any solution anywhere online.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment