scherroman/mugen

Feature request - Photos instead of video

Opened this issue · 2 comments

It would be great if there was a way to import photos / images as well as videos and cut on the beat.

Is this something that has been concidered for the project?

That's a great idea! Will think on this

I found a kinda messy way to do this using moviepy.

import os
import glob
from natsort import natsorted
from moviepy.editor import *
from pathlib import Path    

base_dir = os.path.realpath("D:\\images")
print(base_dir)

fps = 24

file_list = glob.glob('D:\\images\\*.*')  # Get all the files in the current directory (Only tested on jpgs and pngs)
file_list_sorted = natsorted(file_list,reverse=False)  # Sort the images

for image in file_list_sorted:
    print(image)
    filename = Path(image).name
    print(filename)
    clips = [ImageClip(image).set_duration(15)]
    concat_clip = concatenate_videoclips(clips, method="compose")
    outputname = 'D:\\images\\outputz\\' + filename + 'output_video.mp4'
    concat_clip.write_videofile(outputname, fps=fps)

There's probably a better way though.