AlUlkesh / sd_save_intermediate_images

Save intermediate images during the sampling process
The Unlicense
110 stars 17 forks source link

Video generator requests #18

Open XeonG opened 1 year ago

XeonG commented 1 year ago

Glad you added that in was just gonna write a tool to automate making them into videos after doing them manually with ffmpeg..

if you could add an option to have the last remaining image or finaly image hold for x seconds.. that would be good.. actually even an option to have the final image at the start hold before showing the step progress.. just some added options like that thanks

XeonG commented 1 year ago

Could I make another suggestion aswel..

If you add the HiRes option.. the video generated only uses the intermediate imagers from the hires... would be nice if the original resoltuion generation of intermediate steps would be included from the first image, and then after the final image that the hires step images afterwards.. that way you get the whole process from start to finish... obviously the it would be better if the video resolution is at the hires size.. so the original 512x generated ones would be resized ?

AlUlkesh commented 1 year ago

@XeonG This commit contains your first feature request. Please let me know, if it works as expected.

About HiRes: Yes, I'm also not happy with the current solution. I'll try to see, what can be done.

XeonG commented 1 year ago

yes thanks that works great...

"About HiRes: Yes, I'm also not happy with the current solution. I'll try to see, what can be done."

The other option I'd be happy with is splitting the first 512x (or whatever res) generation and the video from that into one file, and then if hires is on another video file? with option to join or split?

XeonG commented 1 year ago

Could you adjust it something like that...

Display last final image at the start for additional frames [checkbox to enable] 10 Display last final image for additional frames [checkbox to enable] 50

Would be better like that imo.. mainly because I'd like to not have the start frame hold for as long as the ending frame...

AlUlkesh commented 1 year ago

Yes, it's more flexible like that. The checkbox is not necessary IMO, setting the value to 0 does the same.

Should work in the latest commit.

AlUlkesh commented 1 year ago

I decided to completely remove the lores/hires distinction. This make things much easier and smoother I think.

XeonG commented 1 year ago

well.. I think I like having the options.. just because I often play with having hires on and off.. and a bigger reason is that having the hires option on.. can often be completely different from the original low res one.. to the point rather just skip showing the lowres one or the hires one depending..... but sometimes only lowres one is interesting as an animation.... but if I have it on its nice to get the results from the usual 512image generation one and then the hires one to see both in animation.... ideally I'd like to be able to split the video and have a merged one of them both like it does currently now so 3 different videos, lowres, hires (if on), and combined lowres+hires (if on).. basically the option to have it generate a low res video option, hires video only option and combined low & hires one?... failing that just a .bat file dumped in the image folder with the ffmpeg args for lowres,hires and both?... on windows it would be useful as its harder to use like '*' file name.. and there is no option in ffmpeg to set the filename to be part of the original filename.. ie is no default ffmpeg arg to output that.. without some external script supplying the output filename...

well anyway if you're bored and want to add some more options to it..

AlUlkesh commented 1 year ago

XeonG: And just another request.. could you support saving the last known settings chosen for everything in the script.. find myself often having to reclick and enter the same things for all the settings.. hopefully it can be supported.

AlUlkesh commented 1 year ago

And just another request.. could you support saving the last known settings chosen for everything in the script.. find myself often having to reclick and enter the same things for all the settings.. hopefully it can be supported.

Well, I think I got it to work. Oddly enough, while webui does save the components' values, it only does it the very first time it is created and then always only loads that.

So I worked around that... There's a save button now and to restore to your last saved settings you have to "Reload UI".

XeonG commented 1 year ago

nice thanks!

AlUlkesh commented 1 year ago

ideally I'd like to be able to split the video and have a merged one of them both like it does currently now so 3 different videos, lowres, hires (if on), and combined lowres+hires (if on)

I just implemented part of that. For video you can now set lores-only, hires-only or lores+hires. If you want lores-only and hires-only in separate files, you'll have to run it twice.

XeonG commented 1 year ago

" If you want lores-only and hires-only in separate files, you'll have to run it twice." yeah damn that is annoying.. only reason is batching it would be nice if it could do 3video encodes ie low only, high only and both.... would still be quicker than going through redoing the seed again with saving out the steps again ... or just a .bat/.sh file with the ffmpeg commands for low, high and both.. which would almost be better as I often go through them later and the video encoding done manually running a bat file would be in a way quicker and less time spending encoding batches that wouldnt' have been kept anyway.. but I dunno how the script works.. just my thinking is that if the steps are done for lo/hi then must be possible?

AlUlkesh commented 1 year ago

The challenge with this was, that ffmpeg only accepts a numbered series of images, if the number is increased by exactly one. Combined with the requirement for an option to repeat the first and last images, I came up with the idea of renaming (and in case of the repeats to copy) the files just before the ffmpeg and restore the previous state after.

However, if you don't care that you can't see the step number in the filename anymore, I could put in an option to skip the restoring part and write some batch files instead. Let me know...

XeonG commented 1 year ago

Well the only thing I can say is that I do like the step number in the file name.. but so long as the final end result for low res and high res image is still there in the folder I could find them without the step number in the file name. Will the encoding videos still be a built in option to have on? but with the option for batch files scripts to be written aswel?

AlUlkesh commented 1 year ago

Yes, that would be in addition. Step number is also stored in the pnginfo btw.

AlUlkesh commented 1 year ago

Here's the bat-files option: image

XeonG commented 1 year ago

Thanks will give it a go now 👍

XeonG commented 1 year ago

ok.. checked it out.. so the plus side is that I can now run the 'lo' .bat and just get the video fo the lo res version while still having the option of the 'lohi' version and a bat file to just get the 'hi' res version

downsides seem to be .. if 'lo' or 'hi' aren't ticked then or make video.. then the .bat file isn't genereted.. meaning doesn't appear to be a way to get the lo, hi .bat files without it also encoding a video aswel?.. and probably the worst thing is that it generates duplicated frames for the options "Display last image for additional frames at the beginning" etc... which I guess is how you did it original and deleted them?

I was sure there was some options in ffmpeg to have it duplicate a frame for x time.. but having also looked at it once, the way of setting options in ffmpeg seems a like a complete mess and what I saw on stackoverflowing for acheiving it didn't look pretty.. so I dunno it kinda defeats the option of not having the encoded video files if the duplicated .png images are taking up more space than the encoded videos..

I guess the option to just have it encode a lo res, hi res, and lo+hi res video would be better as an option and not have all the extra step files that are duplicated?

AlUlkesh commented 1 year ago

I put in an option to not encode the video, if you're doing bat-files:

image

The file copies take up zero disk space. Because they are not copies, they're links:

image

XeonG commented 1 year ago

cool what is that link properties tool called?

also is there no way to get the 3rd bat option that encodes both lo and hi res.. much like the built in one does if lo and hi are ticked?

AlUlkesh commented 1 year ago

@XeonG

also is there no way to get the 3rd bat option that encodes both lo and hi res.. much like the built in one does if lo and hi are ticked?

I can't think of an easy way to do all versions at the same time. To have lo and hires separated you need a numbering scheme that sets these two apart. To do both you'd need one with an uninterrupted numbering scheme.

cool what is that link properties tool called?

Well, in python I use os.link. On windows you can use the mlinkcommand with the /H parameter.

You can also install the Link Shell Extension, that one puts useful things into the context menu: https://schinagl.priv.at/nt/hardlinkshellext/hardlinkshellext.html