opencv VideoWriter 保存空文件,只有6k

frame size的原因,videowrite创建的视频文件的size和要写入的frame size不一致

“` python
out = cv2.VideoWriter(‘out1.avi’, cv2.VideoWriter_fourcc(*’XVID’), 20, (200,300),1)

改成
size = (int(cap.get(cv2.CAP_PROP_FRAME_WIDTH)),
int(cap.get(cv2.CAP_PROP_FRAME_HEIGHT)))

out = cv2.VideoWriter(‘out1.avi’, cv2.VideoWriter_fourcc(*’XVID’), 20, size,1)

你可能感兴趣的:(opencv)