其他分享
首页 > 其他分享> > cv2.VideoWriter

cv2.VideoWriter

作者:互联网

videoCapture = cv2.VideoCapture(args.video_name)
fps = videoCapture.get(cv2.CAP_PROP_FPS)
size = (int(videoCapture.get(cv2.CAP_PROP_FRAME_WIDTH)),int(videoCapture.get(cv2.CAP_PROP_FRAME_HEIGHT)))
print("fps:",fps,"size:",size)
videoWriter = cv2.VideoWriter("./video/result.avi",cv2.VideoWriter_fourcc('X','V','I','D'),fps,size)
# 创建视频流写入对象,VideoWriter_fourcc为视频编解码器,20为帧播放速率,(640,480)为视频帧大小
videoWriter = cv2.VideoWriter('video.avi', cv2.VideoWriter_fourcc('I', '4', '2', '0'), 20, (640,480))
# 向视频文件写入一帧
videoWriter.write(frame)

参考: cv2.VideoCapture()和cv2.VideoWriter_fourcc()

标签:cv2,videoCapture,fps,fourcc,VideoWriter,size
来源: https://blog.csdn.net/qq_35482604/article/details/110189176