I want to create multiple videos from a folder of pictures and a folder of mp3 files. I can manage creating one how ever i want the program to do it for all of the files.
I have 10 pics and 10 mp3 files that i want to be paired in order to make 10 different videos. plus, I want each video to have a different name so they would not be overwritten.
Thanks in advance for any advice.
from moviepy.editor import *
import glob
pics=[]
for filename in glob.glob('C:/1/Images/*.jpg'):
pics.append(filename)
# clip1 = ImageClip(filename).set_duration(600)
musics=[]
for filename in glob.glob('D:/1/music/*.mp3'):
AudioFileClip(filename)
musics.append(filename)
# clip2 = clip1.set_audio(AudioFileClip('D:/1/music/*.mp3'))
x=0
for pic in pics and music in musics:
clip1 = ImageClip(pic).set_duration(600)
clip2 = clip1.set_audio(AudioFileClip(music))
x=x+1
clip2.write_videofile("video-output.mp4", fps=24, remove_temp=True, codec="mpeg4", audio_codec="mp3")