Back to rankings

nateraw/stable-diffusion-videos

Python

Create 🔥 videos with Stable Diffusion by exploring the latent space and morphing between text prompts

ai-arthuggingfacehuggingface-diffusersmachine-learningstable-diffusion
Star Growth
Stars
4.7k
Forks
446
Weekly Growth
Issues
49
2k3k4k
Sep 2022Dec 2023Apr 2025Jul 2026
ArtifactsPyPIpip install stable-diffusion-videos
README

stable-diffusion-videos

Try it yourself in Colab: Open In Colab

Example - morphing between "blueberry spaghetti" and "strawberry spaghetti"

https://user-images.githubusercontent.com/32437151/188721341-6f28abf9-699b-46b0-a72e-fa2a624ba0bb.mp4

Installation

pip install stable_diffusion_videos

Usage

Check out the examples folder for example scripts 👀

Making Videos

Note: For Apple M1 architecture, use torch.float32 instead, as torch.float16 is not available on MPS.

from stable_diffusion_videos import StableDiffusionWalkPipeline
import torch

pipeline = StableDiffusionWalkPipeline.from_pretrained(
    "CompVis/stable-diffusion-v1-4",
    torch_dtype=torch.float16,
).to("cuda")

video_path = pipeline.walk(
    prompts=['a cat', 'a dog'],
    seeds=[42, 1337],
    num_interpolation_steps=3,
    height=512,  # use multiples of 64 if > 512. Multiples of 8 if < 512.
    width=512,   # use multiples of 64 if > 512. Multiples of 8 if < 512.
    output_dir='dreams',        # Where images/videos will be saved
    name='animals_test',        # Subdirectory of output_dir where images/videos will be saved
    guidance_scale=8.5,         # Higher adheres to prompt more, lower lets model take the wheel
    num_inference_steps=50,     # Number of diffusion steps per image generated. 50 is good default
)

Making Music Videos

New! Music can be added to the video by providing a path to an audio file. The audio will inform the rate of interpolation so the videos move to the beat 🎶

from stable_diffusion_videos import StableDiffusionWalkPipeline
import torch

pipeline = StableDiffusionWalkPipeline.from_pretrained(
    "CompVis/stable-diffusion-v1-4",
    torch_dtype=torch.float16,
).to("cuda")

# Seconds in the song.
audio_offsets = [146, 148]  # [Start, end]
fps = 30  # Use lower values for testing (5 or 10), higher values for better quality (30 or 60)

# Convert seconds to frames
num_interpolation_steps = [(b-a) * fps for a, b in zip(audio_offsets, audio_offsets[1:])]

video_path = pipeline.walk(
    prompts=['a cat', 'a dog'],
    seeds=[42, 1337],
    num_interpolation_steps=num_interpolation_steps,
    audio_filepath='audio.mp3',
    audio_start_sec=audio_offsets[0],
    fps=fps,
    height=512,  # use multiples of 64 if > 512. Multiples of 8 if < 512.
    width=512,   # use multiples of 64 if > 512. Multiples of 8 if < 512.
    output_dir='dreams',        # Where images/videos will be saved
    guidance_scale=7.5,         # Higher adheres to prompt more, lower lets model take the wheel
    num_inference_steps=50,     # Number of diffusion steps per image generated. 50 is good default
)

Using the UI

from stable_diffusion_videos import StableDiffusionWalkPipeline, Interface
import torch

pipeline = StableDiffusionWalkPipeline.from_pretrained(
    "CompVis/stable-diffusion-v1-4",
    torch_dtype=torch.float16,
).to("cuda")

interface = Interface(pipeline)
interface.launch()

Credits

This work built off of a script shared by @karpathy. The script was modified to this gist, which was then updated/modified to this repo.

Contributing

You can file any issues/feature requests here

Enjoy 🤗

Related repositories
AUTOMATIC1111/stable-diffusion-webui

Stable Diffusion web UI

PythonPyPIGNU Affero General Public License v3.0deep-learningdiffusion
164.3k30.4k
invoke-ai/InvokeAI

Invoke is a leading creative engine for Stable Diffusion models, empowering professionals, artists, and enthusiasts to generate and create visual media using the latest AI-driven technologies. The solution offers an industry leading WebUI, and serves as the foundation for multiple commercial products.

PythonPyPIApache License 2.0ai-artartificial-intelligence
invoke-ai.github.io/InvokeAI/
27.6k2.9k
camenduru/stable-diffusion-webui-colab

stable diffusion webui colab

Jupyter NotebookThe Unlicensestable-diffusionstable-diffusion-web-ui
15.9k2.6k
willwulfken/MidJourney-Styles-and-Keywords-Reference

A reference containing Styles and Keywords that you can use with MidJourney AI. There are also pages showing resolution comparison, image weights, and much more!

aiartificial-intelligence
12.3k1.6k
jamez-bondos/awesome-gpt4o-images

Awesome curated collection of images and prompts generated by GPT-4o and gpt-image-1. Explore AI generated visuals created with ChatGPT and Sora, showcasing OpenAI’s advanced image generation capabilities.

JavaScriptnpmOtherai-artawesome-list
animeai.online/gallery
8.1k1.8k
AbdullahAlfaraj/Auto-Photoshop-StableDiffusion-Plugin

A user-friendly plug-in that makes it easy to generate stable diffusion images inside Photoshop using either Automatic or ComfyUI as a backend.

TypeScriptnpmMIT Licenseaiart
7.3k529
vladmandic/sdnext

SD.Next: All-in-one WebUI for AI generative image and video creation, captioning and processing

PythonPyPIApache License 2.0sdnextai-art
vladmandic.github.io/sdnext/
7.2k563
vladmandic/automatic

SD.Next: All-in-one for AI generative image

PythonPyPIstable-diffusiongenerative-art
vladmandic.github.io/sdnext-docs/
5.9k448
philz1337x/clarity-upscaler

Clarity AI | AI Image Upscaler & Enhancer - free and open-source Magnific Alternative

PythonPyPIGNU Affero General Public License v3.0aiai-art
clarityai.co
5.1k533
filipecalegario/awesome-generative-ai

A curated list of Generative AI tools, works, models, and references

Creative Commons Zero v1.0 Universalawesome-listawesome
3.5k830
FurkanGozukara/Stable-Diffusion

FLUX, Stable Diffusion, SDXL, SD3, LoRA, Fine Tuning, DreamBooth, Training, Automatic1111, Forge WebUI, SwarmUI, DeepFake, TTS, Animation, Text To Video, Tutorials, Guides, Lectures, Courses, ComfyUI, Google Colab, RunPod, Kaggle, NoteBooks, ControlNet, TTS, Voice Cloning, AI, AI News, ML, ML News, News, Tech, Tech News, Kohya, Midjourney, RunPod

HTMLGNU General Public License v3.0dreamboothguides
youtube.com/SECourses
2.7k371
Stability-AI/stability-sdk

SDK for interacting with stability.ai APIs (e.g. stable diffusion inference)

Jupyter NotebookMIT Licensestable-diffusionai-art
platform.stability.ai
2.4k339