Search code examples
pythonpython-3.xmoviepy

How to make a blank video with Moviepy


How can I make a completely black video with no sound using moviepy? Preferrably with the size and duration of a base clip, eg 1280x720 and 5 seconds long at 30fps.


Solution

  • This is a a way:

    from moviepy.editor import *
    
    def color_clip(size, duration, fps=25, color=(0,0,0), output='color.mp4'):
        ColorClip(size, color, duration=duration).write_videofile(output, fps=fps)
    
    if __name__ == '__main__':
        size = (200, 100)
        duration = 5
        color_clip(size, duration)