Nodes/kubakub nodes/kubakub deflicker
ComfyUI Node

kubakub deflicker

Because diffusion video flickers and you can't fix it in the graph

By kubakubkub·Created about a month ago·Updated 2 days ago· 10
kubakub deflicker
  • images
  • mask
  • images
◄window9►
◄grid8►
◄strength1.00►

What it's for

Diffusion video flickers. Not in an artistic way - in a "the wall behind the dancer changes brightness by four percent every other frame" way, which is very obvious once it's projected eight metres wide. Timelapses flicker for the neighbouring reason: exposure changes between frames.

The community's historical answer has been to leave ComfyUI and do it in Resolve, whose deflicker is behind the paid tier. That's a real pattern in the corpus - deflicker shows up in a couple hundred threads and almost always as a step in someone else's application. kubakub deflicker is that step, in the graph, after your sampler and before the export. It's not doing anything clever. That's the point: deterministic, cheap, done.

How it works

Two knobs do all the work.

grid splits the frame into a grid × grid lattice of zones - 8 by default, so 64 of them. Then each zone's colour is moved to its average over a window of neighbouring frames (9 by default, so four frames either side). Brightness and colour, per zone, temporally smoothed.

The cleverness is what that leaves alone. Because the correction is a per-zone gain and not a blur, movement stays sharp - a hand crossing the frame doesn't smear, it just stops carrying its brightness jumps. Slow fades survive too, because the averaging window is short relative to them. Set grid to 1 and you're averaging the whole frame at once, which is the right setting for uniform exposure flicker in a timelapse and the wrong one for localised shimmer from a diffusion pass.

strength at 1 takes out all of the measured jump, at 0 does nothing. You'll usually want something in between: total removal can flatten a genuine change in lighting across a shot.

Inputs and outputs

  • images - the frames. It needs at least 3; give it fewer and it returns them unchanged and logs a line to the console. Worth knowing, because "the node did nothing" is usually this.
  • window - 3 to 121. More is calmer but slower to react; if you can see the correction lagging behind a real lighting change, this is too high.
  • grid - 1 to 64. 1 for global exposure flicker, 8 for diffusion shimmer, higher if the shimmer is in small areas.
  • strength - 0 to 1.
  • mask (optional) - calm the flicker only inside a mask. File this one away: you can isolate the flickery region and leave a deliberately pulsing element alone in the same shot.

One output, images, back into the pipeline. Then burn-in for review copies, or kubakub export video / frames.

Install

Manager → kubakub nodes → install → restart. Manual:

cd ComfyUI/custom_nodes
git clone https://github.com/kubakubkub/ComfyUI_KubaNodes
python -m pip install -r ComfyUI_KubaNodes/requirements.txt

Needs ComfyUI 0.37.0 or newer; the only added dependency is opencv-python-headless (keep your own OpenCV build if you have one). The pack runs its per-frame work across a thread pool, so this is one of the nodes that genuinely likes having CPU cores spare.

Common issues

  • It returned my frames untouched. Fewer than three frames. That's the whole check.
  • Ghosting on fast motion. Raise strength too high and a zone that legitimately changed colour frame to frame gets pulled back toward its neighbours. Lower grid if the flicker is global, lower strength if it isn't.
  • It can't fix geometry flicker. This corrects brightness and colour. If the structure crawls - window frames wobbling, edges breathing - that's the sampler, not the grade, and no deflicker on earth will put the windows back.
  • Do this before colour match or after? After the generative work and before delivery. If you colour-match first and then deflicker, you're smoothing a transform that was already constant per shot, which is wasted work but harmless.
Categorykubakub/2d/post

Inputs (5)

NameTypeDefaultDescription
imagesIMAGEThe frames (at least 3).
windowINT93–121Frames to average over; more = calmer, slower changes survive.
gridINT81–641 = the whole frame at once; 8 = local flicker in 8 x 8 zones.
strengthFLOAT1.000–1How much of the jumps is taken out: 1 = all, 0 = the frames as they are.
maskoptMASKCalms the flicker only inside this mask (white = full, grey = partly); outside the frames stay as they are. One mask serves every frame; another size is resized.

Outputs (1)

NameTypeDescription
imagesIMAGE—