Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Feature request - Photos instead of video #26

Open
kahwoo opened this issue Oct 16, 2021 · 2 comments
Open

Feature request - Photos instead of video #26

kahwoo opened this issue Oct 16, 2021 · 2 comments

Comments

@kahwoo
Copy link

kahwoo commented Oct 16, 2021

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?

@scherroman
Copy link
Owner

That's a great idea! Will think on this

@kahwoo
Copy link
Author

kahwoo commented Feb 3, 2022

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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants