#环境:opencv 3.4.0 python 3.5.2#读取视频import cv2cap = cv2.VideoCapture('video.avi')#读取摄像头,0为摄像头索引,当有多个摄像头时...为视频编解码器,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...OpenCV3 Computer Vision with Python,坦白讲不太懂)#fourcc意为四字符代码(Four-Character Codes),顾名思义,该编码由四个字符组成,下面是VideoWriter_fourcc...,文件名后缀为.avi#cv2.VideoWriter_fourcc('T', 'H', 'E', 'O'),该参数是Ogg Vorbis,文件名后缀为.ogv#cv2.VideoWriter_fourcc