import cv2 as cv capture = cv.VideoCapture(1) while (True): # ret为返回值,frame为视频的每一帧 ret, frame = capture.read() cv.imshow("video", frame) c = cv.waitKey(50) # 按了esc候可以退出 if c == 27: break