The loopback wave script is an img2img script which modulates the denoising strength in a sinusoidal fasion, then produces a video from it. The effect this produces is a "stable" image, followed by a gradual then drastic change to another image which then also stabilizes.
Outputs can be found in
ffmpegneeds to be installed. If its not on your PATH, you may need to manually specify the executable location.
- For VP9 webm, ffmpeg must be compiled with
- For VP8 webm, ffmpeg must be compiled with
- For H.265 mp4, ffmpeg must be compiled with
- For H.264 mp4, ffmpeg must be compiled with
- Get stable diffusion webui working
- Copy the script
- Save the script in stable-diffusion-ui/scripts
- Go to img2img with a good img.
- Select loopback wave from the scripts list
Important Non-script params:
- Denoising Strength: Sets the lowest possible denoising strength used in the loopback
- Frames: 100
- Frames Per Wave: How many frames for a full cycle of stable/unstable.
- Max Additional Denoise: Maximum denoising strength to add to the base denoising strength
- Wave Offset: The offset from 0, in degrees, on the cos wave. Normally leave this at 0
- List of prompt changes: A line-separated list of prompts.
- Initial Image Number: The number of the first file produced
- Frames per second: 10
- Video Quality (crf): Quality setting to pass to ffmpeg. For VP9 webms, 30 is pretty good, 40 is still good but much smaller.
- Video Encoding: What encoding to use. VP9 is best, but the others are there for compatibility sake. Optimal CRF is different with different encodings.
For encoding, I fucked something up and 4chan hates my mp4 outputs. Stick to webms for now.
Prompt Changes text box can be used to change the prompt at a given frame. Simply type the frame number when you want the transition to occur, followed by
:: and then your prompt.
Would alter the prompt at frames 100 and 500 with the respective prompts.
As of V1.3, it is possible to explicitly set the seed at a given frame.
At frame 100, we set the seed to 123 and keep it constant. Then at frame 500, the seed is changed to 654, but the seed is incremented every iteration. So the next image would be seed 655, then 656, 657, and so on.
Weights can be set proportional to the current progress through a wave.
(foo:@wave_completed(0.5,1)) would modulate the weight of
1 with respect to the completed percent of the current waveform
(foo:@wave_remaining(0.5,1)) would modulate the weight of
0.5 with respect to the remaining percent of the current waveform
The webm below was generated using the parameters beneath.
- Edit stable-diffusion-webui-docker-master\services\AUTOMATIC1111\Dockerfile and add the following under the "RUN pip install opencv-python-headless..." command:
- Drop the script into stable-diffusion-webui-docker-master\data\config\auto\scripts\loopback_wave.py
- Restart the docker container and wait for ffmpeg to download, it will be cached on subsequent boots.
- Fixed wave weight functions
- Added functions which allow weighting prompts dynamically according to wave transition
- Added @wave_remaining(min, max)
- Added @wave_completed(min, max)
- Added explicit seed settings
- Added more params to the text file output.
- Fixed FPS Bug
Initial Image Numberparameter
- Added windows support
- Simplified some parameters