import cv2
vc = cv2.VideoCapture(0)
fps = 20000
size = (int(vc.get(cv2.CAP_PROP_FRAME_WIDTH)),
int(vc.get(cv2.CAP_PROP_FRAME_HEIGHT)))
vw = cv2.VideoWriter('test2-7out.avi',
cv2.VideoWriter_fourcc('X', 'V', 'I', 'D'),
fps, size)
success, frame = vc.read()
while success:
vw.write(frame)
cv2.imshow('MyCamera', frame)
key = cv2.waitKey()
if key == 27:
break
success, frame = vc.read()
vc.release()
标签:vc,success,python,frame,CAP,cv2,开启,int,摄像头
From: https://blog.51cto.com/lizhao/8861606