Nodes/Difforum/Difforum · Live Sampler (realtime loop)
ComfyUI Node

Difforum · Live Sampler (realtime loop)

A realtime Deforum loop with a live preview — queue once, watch it generate

By chillithebillis·Created 3 months ago·Updated about a month ago· 7
Difforum · Live Sampler (realtime loop)
  • model
  • positive
  • negative
  • vae
  • params
  • camera
  • init_image
  • positive_schedule
  • depth
  • control_net
  • frames
duration_frames240
strength0.50
steps2
cfg1.2
sampler_namelcm
schedulersgm_uniform
color_coherence0.50
color_modelab
symmetrynone
symmetry_segments6
target_fps0.0
sharpen0.20
noise0.020
cadence1
control_strength0.60
live_previewtrue
live_source
source_blend0.90
stream_dir
spout_name
loop_cameratrue
seed0
seed_modefixed

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_fps throttles 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_preview is off, or the node didn't reload - restart ComfyUI fully (console: [Difforum] loaded N nodes).
  • Webcam input does nothing. opencv-python isn't installed, or the device index is wrong. Try 0, then 1.
  • 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.

CategoryDifforum/live

Inputs (33)

NameTypeDefaultDescription
modelMODEL
positiveCONDITIONING
negativeCONDITIONING
vaeVAE
paramsDIFFORUM_PARAMS
cameraDIFFORUM_CAMERA
init_imageIMAGE
duration_framesINT2401–1000000
strengthFLOAT0.500–1
stepsINT21–50
cfgFLOAT1.20–15
sampler_nameCOMBOlcm44 options: euler, euler_cfg_pp, euler_ancestral, euler_ancestral_cfg_pp, heun, heunpp2, +38
schedulerCOMBOsgm_uniform9 options: simple, sgm_uniform, karras, exponential, ddim_uniform, beta, +3
color_coherenceFLOAT0.500–1
color_modeCOMBOlab3 options: lab, rgb, none
symmetryCOMBOnone5 options: none, mirror_h, mirror_v, mirror_quad, kaleidoscope
symmetry_segmentsINT62–64
target_fpsFLOAT0.00–60
sharpenFLOAT0.200–2
noiseFLOAT0.0200–0.5
cadenceINT11–12
positive_scheduleoptDIFFORUM_PROMPT
depthoptIMAGE
control_netoptCONTROL_NET
control_strengthoptFLOAT0.600–3
live_previewoptBOOLEANtrue
live_sourceoptSTRING
source_blendoptFLOAT0.900–1
stream_diroptSTRING
spout_nameoptSTRING
loop_cameraoptBOOLEANtrue
seedoptINT00–18446744073709550000
seed_modeoptCOMBOfixed2 options: fixed, increment

Outputs (1)

NameTypeDescription
framesIMAGE