Answers for "opencv rtsp stream python with username and password"

0

opencv rtsp stream python with username and password

import cv2
import os
 
RTSP_URL = 'rtsp://user:[email protected]:554/h264Preview_01_main'
 
os.environ['OPENCV_FFMPEG_CAPTURE_OPTIONS'] = 'rtsp_transport;udp'
 
cap = cv2.VideoCapture(RTSP_URL, cv2.CAP_FFMPEG)
 
if not cap.isOpened():
    print('Cannot open RTSP stream')
    exit(-1)
 
while True:
    _, frame = cap.read()
    cv2.imshow('RTSP stream', frame)
 
    if cv2.waitKey(1) == 27:
        break
 
cap.release()
cv2.destroyAllWindows()
Posted by: Guest on August-04-2021

Code answers related to "opencv rtsp stream python with username and password"

Code answers related to "Javascript"

Browse Popular Code Answers by Language