Difforum · Live Sampler (realtime loop)
A realtime Deforum loop with a live preview — queue once, watch it generate
- model
- positive
- negative
- vae
- params
- camera
- init_image
- positive_schedule
- depth
- control_net
- frames
Stock ComfyUI re-runs your whole graph every time you hit Queue Prompt - fine for a still, useless for "I want to see this Deforum loop happen." Difforum · Live Sampler (realtime loop) is the pack's native realtime engine: it keeps the model resident and runs its own internal loop, each tick warping the camera, folding the symmetry, re-diffusing 1–2 steps, colour-matching, and streaming a live preview into the node as it goes. You queue once and watch it generate. No external runtime, no auto-queue hack, no frames piling up in a temp folder. This is the node that takes Difforum from "render a clip" to "perform a clip."
The catch is honest and unavoidable: realtime means a realtime model. The recipe the README spells out is few-step distillation - SD-Turbo, SDXL-Turbo, LCM, or DMD2 at 1–2 steps, cfg ~1, at 512px. On a Turbo model it genuinely runs live; on a 20-step SDXL render it just runs fast-ish with a nice preview. Same steps/cfg/sampler_name/scheduler family as the Feedback Sampler, but with live-grade defaults baked in (steps=2, cfg=1.2, sampler_name=lcm, scheduler=sgm_uniform).
The inputs worth knowing beyond the sampler basics:
duration_frames- how long the loop runs (default 240). It's a render length, not an endless stream.live_preview(default on) - the in-node preview. Turn it off if you're running headless or exporting instead of watching.live_source- the "magic mirror": set it to a webcam device index (0) or a video path and the loop stylizes the live feed - camera → kaleidoscope → diffusion, realtime.source_blend(default 0.9) mixes the live source over the warped feedback.stream_dir- writes frames to a folder OBS/Resolume/ffmpeg can read live;spout_name- Spout video out for VJ apps (needs the SpoutGL extra). This is the "map it to a VJ show" half of the node.loop_camera(default on) - wraps the camera track so the loop keeps cycling past the end of the schedule.cadence- diffuse every Nth tick only; the biggest raw FPS lever after the model choice.target_fpsthrottles the loop to a rate, which is how you keep a live set from running away.
Output: frames (IMAGE batch) of the whole session - you get the live show and the rendered clip out of one run.
Install
cd ComfyUI/custom_nodes
git clone https://github.com/chillithebillis/Difforum.git difforum
Restart ComfyUI ([Difforum] loaded N nodes) or ComfyUI Manager → "Difforum". numpy-only core; optional extras: webcam needs opencv-python, Spout needs SpoutGL (the README flags both). The difforum_realtime_live.json template wires a Turbo checkpoint in with a kaleidoscope ready to go.
Common issues
- "It's not realtime." You're on a full-strength model, or at a big resolution. Drop to a Turbo/LCM/DMD2 model, 1–2 steps, 512px, and add
cadence=2–3. The math is relentless; meet it halfway. - No preview.
live_previewis off, or the node didn't reload - restart ComfyUI fully (console:[Difforum] loaded N nodes). - Webcam input does nothing.
opencv-pythonisn't installed, or the device index is wrong. Try0, then1. - MPS users: fp8 checkpoints fail on Apple Silicon (no fp8 kernels). Use fp16/bf16 or GGUF - the Model Profile node auto-adjusts its recommendation on Macs.
The honest framing: this is the most fun node in the pack, and the one with the most moving parts. The first time you feed it a webcam and watch your face get kaleidoscoped and re-diffused in realtime, you'll understand why the author wrote REALTIME.md. Start with the template, get a loop happening, then start pulling the VJ levers.
Inputs (33)
| Name | Type | Default | Description |
|---|---|---|---|
| model | MODEL | — | |
| positive | CONDITIONING | — | |
| negative | CONDITIONING | — | |
| vae | VAE | — | |
| params | DIFFORUM_PARAMS | — | |
| camera | DIFFORUM_CAMERA | — | |
| init_image | IMAGE | — | |
| duration_frames | INT | 2401–1000000 | — |
| strength | FLOAT | 0.500–1 | — |
| steps | INT | 21–50 | — |
| cfg | FLOAT | 1.20–15 | — |
| sampler_name | COMBO | lcm | 44 options: euler, euler_cfg_pp, euler_ancestral, euler_ancestral_cfg_pp, heun, heunpp2, +38 |
| scheduler | COMBO | sgm_uniform | 9 options: simple, sgm_uniform, karras, exponential, ddim_uniform, beta, +3 |
| color_coherence | FLOAT | 0.500–1 | — |
| color_mode | COMBO | lab | 3 options: lab, rgb, none |
| symmetry | COMBO | none | 5 options: none, mirror_h, mirror_v, mirror_quad, kaleidoscope |
| symmetry_segments | INT | 62–64 | — |
| target_fps | FLOAT | 0.00–60 | — |
| sharpen | FLOAT | 0.200–2 | — |
| noise | FLOAT | 0.0200–0.5 | — |
| cadence | INT | 11–12 | — |
| positive_scheduleopt | DIFFORUM_PROMPT | — | |
| depthopt | IMAGE | — | |
| control_netopt | CONTROL_NET | — | |
| control_strengthopt | FLOAT | 0.600–3 | — |
| live_previewopt | BOOLEAN | true | — |
| live_sourceopt | STRING | — | |
| source_blendopt | FLOAT | 0.900–1 | — |
| stream_diropt | STRING | — | |
| spout_nameopt | STRING | — | |
| loop_cameraopt | BOOLEAN | true | — |
| seedopt | INT | 00–18446744073709550000 | — |
| seed_modeopt | COMBO | fixed | 2 options: fixed, increment |
Outputs (1)
| Name | Type | Description |
|---|---|---|
| frames | IMAGE | — |