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

posted on 2017-06-18 00:47  lion_zheng  阅读(1042)  评论(0编辑  收藏  举报

导航