sd-webui-controlnet
sd-webui-controlnet copied to clipboard
[Feature Request]: Movie2Movie - Option to choose directory of images instead of video file
Is it possible to add an option to define a directory of images instead of a video file when using the movie2movie script?
The detectmaps change a lot when videos are used instead of png files.
you can use my concactenator to turn the folder of images into a mp4 file alternatively. https://github.com/GeekyGhost/Concactenator
oops misunderstood. could probably make an extractor version.
Thanks but that's not what I need. I made a temporary edit that works for me at the moment.
I duplicated the movie2movie script so as to keep my edit separate and the original safe.
I added import numpy as np
to the top.
I changed get_all_frames
method to
if video_path is None:
return None
print("video_path value is: " + video_path)
frames = []
for filename in sorted(os.listdir(video_path)):
if filename.endswith(".png"):
image = Image.open(os.path.join(video_path, filename))
frame = np.array(image)
frames.append(frame)
return frames
In the UI
method, I removed the video element and added a textbox element instead:
ctrls_group += (gr.Textbox(label='Enter directory to images', elem_id = f"dir_{i}"), )
In the title
method I changed it to return "controlnet m2m PATH"
In the run
method, I changed the two occurances of video
to textbox
It works mostly, the only problem is if you have multi-controlnet and you're only using 1 of them, then it throws a Filenotfound
error, so I just fill the all the textboxes, even the ones I'm not using and then it all works.
I'm no expert at this, I just needed it to work so I did what I could for me, I'm only posting this in case it helps anyone else.
Hi @porkchopjohnson -- could you post your modified script? Would be great to have as an alternate.
Sure, like I said it works but if you have multi controlnet enabled, you have to fill in the directory/path for all controlnets and then it will work. Also, I've set it up to look for png files so I'm not sure if it will work for file types. You can extract it into the scripts folder within controlnet's folder.
Here's a script I modified to use image sequences instead of mp4! https://toyxyz.gumroad.com/l/jydvk
Here's a script I modified to use image sequences instead of mp4! https://toyxyz.gumroad.com/l/jydvk
That's exactly what I'm looking for! Thank you.
I was thinking about this, you could also you image 2 image batch process with controlnet if you have a folder of images.