Nodes/Difforum/Difforum · Live Sampler
ComfyUI Node

Difforum · Live Sampler

Queue Once and Watch It Play Inside the Node

By chillithebillis·Created 4 months ago·Updated 11 days ago· 10
Difforum · Live Sampler
  • model
  • positive
  • negative
  • vae
  • init_image
  • direction
  • options
  • params
  • camera
  • strength
  • prompts
  • depth
  • frames
  • report
◄run_frames480►
◄steps2►
◄cfg1.2►
◄sampler_namelcm►
◄schedulersgm_uniform►
◄cadence1►
◄target_fps0.0►
◄energy0.50►
◄loop_cameratrue►
◄live_source►
◄source_blend0.90►
◄stream_dir►
◄spout_name►
◄keep_frames240►
◄live_previewtrue►

The Feedback Sampler runs to completion and hands you a clip. The Live Sampler does the same loop in real time and shows you the frames while it runs - which changes what the tool is for. It's not a rendering node. It's a performance instrument.

The setup

Pair it with a 1–4 step model - SD-Turbo, SDXL-Turbo, LCM, DMD2 - at around 512 px. The defaults are already that: steps 2, cfg 1.2, sampler_name lcm, scheduler sgm_uniform. Distilled models collapse a 20-step trajectory into two, which is the only reason a per-frame feedback loop can keep up with reality; if you point this at a regular SDXL checkpoint at 20 steps you'll get a slideshow, not a live render.

Required inputs are the usual four (model, positive, negative, vae) plus init_image. run_frames (480) is how many frames to run, and loop_camera (on) repeats the camera when the run is longer than the clip - that's what makes a short move into an endless one for VJ use.

The inputs that make it a live tool

  • live_source - '' off, '0' for webcam, or a video path. It's mixed in before each frame, so the model is re-imagining the live feed continuously. Point it at a webcam and you have a magic mirror; point it at a looping video and you have a per-frame restyle engine.
  • source_blend (0.9) - how much of the live source enters each frame. This is the feedback-vs-live dial. High means the source dominates; lower means the model's own history accumulates and the image drifts away from the input, which is where the interesting artifacts live.
  • stream_dir and spout_name - where the frames go. stream_dir writes live PNGs to a folder, which any other app can pick up. spout_name is a Spout sender for Resolume, TouchDesigner or OBS - Windows only, and it needs pip install SpoutGL; the node prints a "Spout output disabled" line and carries on if the import fails, which is the right behaviour and also the reason people sometimes think Spout is broken when it's just not installed.
  • target_fps - caps the speed. 0 means as fast as the hardware goes, which on a 4090 with a turbo model is faster than your eyes and warmer than your room.
  • keep_frames (240) and live_preview - a ring buffer, so a long session doesn't fill RAM with 10,000 frames you'll never look at. frames returns only the tail.

Outputs

frames (the kept portion - wire it to Save or Video Combine after you stop) and report, which is worth reading once: it tells you the achieved frame rate.

Install

ComfyUI Manager → search "Difforum", or:

cd ComfyUI/custom_nodes && git clone https://github.com/chillithebillis/Difforum.git difforum

Restart. Base install is numpy only; webcam and video-file input need OpenCV (pip install opencv-python) and Spout output needs SpoutGL on Windows. Both are imported lazily, so a machine without them still loads the pack fine - only the features that need them go quiet.

Where people get burned

The model, first and always. A 4-step LCM model at 512 px is the difference between an instrument and a coffee break. Second: run_frames of 480 at 24 fps is 20 seconds, and the node will happily run until it finishes or you interrupt - there's no "keep going until I say stop", so for a long session you re-queue with a large run_frames rather than expecting it to stay open.

And the occasional reminder: a live source mixed at high blend with a strong camera move produces feedback that eats itself into mush within a few seconds. That's the loop, not a bug. Pull source_blend up or dial the energy down when it happens.

CategoryDifforum/4 · Render

Inputs (27)

NameTypeDefaultDescription
modelMODELThe image model (SD1.5 / SDXL / Flux / turbo). MODEL output of your checkpoint or LoRA chain.
positiveCONDITIONINGPositive conditioning (CLIP Text Encode).
negativeCONDITIONINGNegative conditioning (CLIP Text Encode).
vaeVAEThe VAE that matches the model.
init_imageIMAGEThe first frame. Everything grows from this image.
run_framesINT4801–10000000How many frames to run (the loop wraps the camera).
stepsINT21–50Steps per frame. Turbo models: 1-4.
cfgFLOAT1.20–15Prompt strength. Turbo / LCM / DMD2 models want 1-2; regular SDXL 4-7.
sampler_nameCOMBOlcmSampler. euler / dpmpp_2m for regular models, euler_ancestral or lcm for turbo.
schedulerCOMBOsgm_uniformNoise schedule. karras / normal for regular models, sgm_uniform for turbo.
cadenceINT11–12Diffuse every Nth frame for speed.
target_fpsFLOAT0.00–60Cap the speed. 0 = as fast as possible.
directionoptDIFFORUM_DIRECTIONThe Director's wire: camera, energy curve, scene prompts, keys and look in one cable.
optionsoptDIFFORUM_OPTIONSDifforum · Render Options: manual colour, detail, symmetry, depth and chunk settings. Without it the Director's look decides.
paramsoptDIFFORUM_PARAMSFrom Setup: frame count, fps, width and height. Plug the same Setup everywhere.
cameraoptDIFFORUM_CAMERAA camera track from Camera (keys), Camera (expressions) or Camera Import. Overrides the Director's camera.
strengthoptDIFFORUM_SCHEDULEA schedule for denoise per frame; replaces the Director's energy curve.
promptsoptDIFFORUM_PROMPTPrompt travel from Prompt Travel (or the Director with CLIP connected).
depthoptIMAGEA depth map (white = near), e.g. Depth Anything V2 on the first frame. Needed for real 3D parallax; without it 3D moves fall back to pseudo-3D.
energyoptFLOAT0.500–1Denoise per frame when no Director is connected.
loop_cameraoptBOOLEANtrueRepeat the camera when the run is longer than the clip.
live_sourceoptSTRING'' = off, '0' = webcam, or a video path: mixed in before each frame.
source_blendoptFLOAT0.900–1How much of the live source enters each frame.
stream_diroptSTRINGFolder to write live PNG frames to (for another app).
spout_nameoptSTRINGSpout sender name (Windows) for Resolume / TouchDesigner / OBS.
keep_framesoptINT2401–100000Frames kept in memory for the output (ring buffer).
live_previewoptBOOLEANtrueShow the frames inside the node while running.

Outputs (2)

NameTypeDescription
framesIMAGE—
reportSTRING—