python 从视频中提取图片,并保存在硬盘上

使用python的moviepy库来提取视频中的图片,按照视频每帧一个图片的方式来保存。

extract images from video, than save them to disk

from moviepy.editor import VideoFileClip

clip1 = VideoFileClip('./project_video.mp4')
i = 1
for frame in clip1.iter_frames():
    im = Image.fromarray(frame)
    im.save("frame_image/your_file_%07d.jpg" % i)
    i = i+1
原文地址:https://www.cnblogs.com/lion-zheng/p/7042623.html