I tried to convert PNG images to video by list images in directory
clips[]
for filename in os.listdir('.'):
if filename.endswith(".png"):
clips.append(ImageClip(filename))
Then convert it
video = concatenate(clips, method='compose')
video.write_videofile('test.mp4')
import os
from moviepy.editor import *
clips = []
base_dir = os.path.realpath(".")
print(base_dir)
for filename in os.listdir('.'):
if filename.endswith(".png"):
clips.append(ImageClip(filename))
video = concatenate(clips, method='compose')
video.write_videofile('test.mp4')
I found another way to do it:
And from current folder:
This is how I did it using your initial code. The error you were seeing was due to not specifying
set_duration
for the clips. I also sorted the files in the directory so that the resulting mp4 is sequential (was not the case by default).