Nodes/ComfyUI-RAVE/KSampler (RAVE)
ComfyUI Node

KSampler (RAVE)

Sample a whole video in one pass — by shuffling the frame grid every step

By spacepxl·Created 3 years ago·Updated 2 years ago· 95
KSampler (RAVE)
  • model
  • positive
  • negative
  • latent_image
  • LATENT
grid_size3
pad_gridfalse
noise_seed0
add_noisefalse
steps20
cfg7.0
sampler_name
scheduler
start_at_step0
end_at_step10000

KSampler (RAVE) is the node that makes ComfyUI-RAVE worth installing. It's the sampler you drop in place of the plain KSampler in a noise-inversion vid2vid workflow, and it lets a stock SD 1.5 (or SDXL) checkpoint edit video with no video model at all. No motion modules, no temporal transformers, no video checkpoint to download. Just a deceptively simple trick: pack your frames into a grid, denoise the whole grid as one image, and shuffle the arrangement every step so the model never learns where a given frame lives.

That trick is the RAVE method from the paper, ported to ComfyUI by spacepxl (spacetug on Reddit). It's a niche, mostly-untouched pack from early 2024 - and its best use case is still text-guided editing of an existing video on a card that can't touch AnimateDiff or Wan.

How it works

You feed it a batch of latents, one per video frame (usually VAE-encoded from frames loaded with VideoHelperSuite). Then for each of steps denoising steps:

  1. Frames are arranged into a grid_size × grid_size grid.
  2. Placement is randomly shuffled, seeded by noise_seed - incremented every step.
  3. One denoising step runs on the whole grid as a single image.
  4. The result is un-gridded back into frames, and it repeats.

Because frame positions change every step, the model can't latch onto "this frame is always in the corner" - the whole clip is denoised as a coherent unit, and temporal consistency comes free from the spatial prior. Longer videos split into multiple grids, sampled side by side; the node prints something like RAVE sampling with 24 frames (3 grids) to the console.

Inputs that matter

Most behave like a normal KSampler; here are the ones a beginner actually touches:

  • latent_image - a batch of frame latents, ideally straight from an Unsampler fed with your VAE-encoded source video.
  • grid_size (2–8, default 3) - cells per side. 3×3 handles 9 frames and is the sweet spot at 512px; drop to 2×2 for speed.
  • noise_seed - drives both the initial noise and the per-step shuffle.
  • add_noise (default False) - RAVE assumes your latents already contain the source video's noise, so it's off by default; only switch it on if you're starting from clean latents.
  • pad_grid - adds a 1px latent border between cells; keep it consistent with the decompose side.
  • steps, cfg, sampler_name, scheduler, positive, negative, start_at_step, end_at_step - behave like the stock KSampler's.

ControlNet and masks are handled for you: if your conditioning carries a ControlNet, the node grids the control hint images (and masks) too, so a depth or pose pass lines up frame-by-frame. Latent noise masks and condition masks work as well - that's how you edit only part of each frame, and it's what the pack's last commit fixed.

Output

A single LATENT, same batch size as the input. VAE decode it and feed the frames to a VHS_VideoCombine to get video back.

Installing it

The pack has no requirements.txt and no model files - RAVE is a method, not a model, and the code only uses torch/torchvision/numpy that ComfyUI already ships. Install via ComfyUI Manager (search "ComfyUI-RAVE") or:

cd ComfyUI/custom_nodes
git clone https://github.com/spacepxl/ComfyUI-RAVE

then restart ComfyUI. You'll also want BlenderNeko's Unsampler (ComfyUI_Noise) - the README calls it required for noise inversion - and VideoHelperSuite (VHS) to load and save video. The repo ships a ready-to-run workflow/RAVE_basic_workflow.json (the cupcake-train example from the paper) with source videos included, so drag it in and drop in your own clip.

Common issues

  • Static frame / leftover noise. The classic. Your Unsampler and this sampler must mirror each other - total steps, start_at_step/end_at_step, sampler and scheduler all need to match. The author's own advice: "check that the settings match between unsampler and ksampler."
  • It's slow. You're sampling at grid_size × your frame resolution - a 3×3 grid of 512px frames is 1536×1536 per step. Start with a short clip and a 2×2 grid to sanity-check.
  • SDXL works but looks worse. SD 1.5 is the intended model; the author's guess is SDXL's multi-resolution training reduces the tiling effect the grid method relies on.
  • Grids at high resolution tile. Nine 512px frames make a 1536×1536 image, past SD's native res, so expect repeated patterns. Keep frames small.
  • New-ComfyUI drift. Last commit is January 2024 and it imports internals like latent_preview; an import error on startup means it's drifted from your ComfyUI - look for a maintained fork.
CategoryRAVE

Inputs (14)

NameTypeDefaultDescription
modelMODEL
grid_sizeINT32–8
pad_gridBOOLEANfalse
noise_seedINT00–18446744073709550000
add_noiseBOOLEANfalse
stepsINT201–10000
cfgFLOAT7.00–100
sampler_nameCOMBO34 options: euler, euler_cfg_pp, euler_ancestral, euler_ancestral_cfg_pp, heun, heunpp2, +28
schedulerCOMBO9 options: normal, karras, exponential, sgm_uniform, simple, ddim_uniform, +3
positiveCONDITIONING
negativeCONDITIONING
latent_imageLATENT
start_at_stepINT00–10000
end_at_stepINT100000–10000

Outputs (1)

NameTypeDescription
LATENTLATENT