import cv2 

def openRtsp(rtspUrl):


        cap = cv2.VideoCapture(rtspUrl)

        if not cap.isOpened():
            print("摄像头连接失败")
            continue
        
        print("摄像头rtsp连接成功")

        while True:

            ret, frame = cap.read() 

            if not ret:
                print("摄像rtsp连接断开")
                break

            if ret: 
                #frame即是当前帧画面,可根据需求进行处理

Logo

腾讯云面向开发者汇聚海量精品云计算使用和开发经验,营造开放的云计算技术生态圈。

更多推荐