为视频编解码器,20为帧播放速率,(640,480)为视频帧大小videoWriter = cv2.VideoWriter('video.avi', cv2.VideoWriter_fourcc('I'..., '4', '2', '0'), 20, (640,480))#向视频文件写入一帧videoWriter.write(frame)#详解cv2.VideoWriter_fourcc对象(摘自Learning...对象一些常用的参数,注意:字符顺序不能弄混#cv2.VideoWriter_fourcc('I', '4', '2', '0'),该参数是YUV编码类型,文件名后缀为.avi#cv2.VideoWriter_fourcc...,文件名后缀为.avi#cv2.VideoWriter_fourcc('T', 'H', 'E', 'O'),该参数是Ogg Vorbis,文件名后缀为.ogv#cv2.VideoWriter_fourcc...= cv2.VideoWriter('video.avi', cv2.VideoWriter_fourcc('I','4','2','0'), fps, size)ret, frame = cap.read