import cv2 class VideoStream: def __init__(self, rtsp_url): self.rtsp_url = rtsp_url self.stream = cv2.VideoCapture(rtsp_url) def get_frame(self): ret, frame = self.stream.read() if not ret: return None return frame