使用opencv读取rtsp流方法,因其简单将不在解释:
import cv2 def read_rtsp(): cap = cv2.VideoCapture('rtsp://admin:[email protected]:554') fourcc = cv2.VideoWriter_fourcc(*'XVID') size = (int(cap.get(cv2.CAP_PROP_FRAME_WIDTH)), int(cap.get(cv2.CAP_PROP_FRAME_HEIGHT))) out = cv2.VideoWriter('./rtsp_video.avi', fourcc,10.0, size) while True: ret, frame = cap.read() out.write(frame) cv2.imshow('frame', frame) cv2.waitKey(1) cap.release() out.release() cv2.destroyAllWindows() if __name__ == '__main__': read_rtsp()
标签:__,rtsp,python,frame,cap,cv2,opencv From: https://www.cnblogs.com/tangjunjun/p/16800081.html