How to make a movie out of images in python

前端 未结 4 1930
野性不改
野性不改 2020-12-02 11:30

I currently try to make a movie out of images, but i could not find anything helpful .

Here is my code so far:

import time

from PIL import  ImageGra         


        
4条回答
  •  青春惊慌失措
    2020-12-02 11:58

    Here is a minimal example using moviepy. For me this was the easiest solution.

    import os
    import moviepy.video.io.ImageSequenceClip
    image_folder='folder_with_images'
    fps=1
    
    image_files = [image_folder+'/'+img for img in os.listdir(image_folder) if img.endswith(".png")]
    clip = moviepy.video.io.ImageSequenceClip.ImageSequenceClip(image_files, fps=fps)
    clip.write_videofile('my_video.mp4')
    

提交回复
热议问题