Zum Inhalt springen →


import cv2

import numpy as np

import os

os.environ["OPENCV_FFMPEG_CAPTURE_OPTIONS"] = "rtsp_transport;udp"

vcap = cv2.VideoCapture("rtsp://192.168.43.1:8554/stream0", cv2.CAP_FFMPEG)
while(1):
    ret, frame = vcap.read()
    if ret == False:
        print("Frame is empty")
        break;
    else:
        size = (800, 600)
        frame = cv2.resize(frame, size, interpolation= cv2.INTER_LINEAR)
        cv2.imshow('VIDEO', frame)
        cv2.waitKey(1)