extract images from video, than save them to disk from moviepy.editor import VideoFileClip clip1 = VideoFileClip('./project_video.mp4') i = 1 for fram ...
使用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