ComfyUI Node

Video De-flicker

Video De-flicker

By Fossiel·Created 10 months ago·Updated 5 months ago· 1
Video De-flicker
  • images
  • IMAGE
window_size10
modemean
strength1.00

If you've generated more than about ten seconds of AI video, you know the problem: the clip is fine, then the whole frame dims for a beat, brightens, dims again. Diffusion models don't have a concept of "steady exposure between frames," so every latent denoise re-rolls the brightness dice a little. This node is the fix - a rolling-average deflicker that evens out frame-to-frame brightness without you leaving ComfyUI for a video editor.

It's the most-visited node in the Fossiel QoL pack, and fittingly the least documented in its README (the changelog mentions it, the body doesn't - the code is the spec).

What it actually does

Video De-flicker is a post-processor, not a sampler or a generation node. You feed it an image batch - the IMAGE output of a VAE Decode, or any set of frames - and it returns the same batch with brightness evened out. Flicker in AI video is largely an exposure problem, so correcting luminance is usually enough.

Here's the mechanism, from the source: it converts each frame to grayscale, measures the mean (or median) brightness, and keeps a rolling history of the last window_size frames. For each frame it computes a reference brightness from that window and applies a multiplicative correction:

factor = (reference / current_brightness) ^ strength

So a frame that's dimmer than its neighbors gets scaled up, a brighter one gets scaled down. It's a classic temporal smoothing approach, the same idea behind the deflicker in DaVinci Resolve that the animation community has leaned on for years - just running right inside the graph.

The inputs that matter

Three knobs, and only two of them need your attention:

  • window_size (1–100, default 10) - how many frames go into the reference. Too small and the filter chases the flicker instead of smoothing it; too large and a legitimate exposure change takes a while to register. Ten is a sane starting point.
  • mode (mean or median) - median is more robust if you have a frame with a big flash or a cut; mean is smoother on gentle noise.
  • strength (0–2, default 1) - how hard to push. 0 is a no-op (handy for A/B testing), 1 is full correction, up to 2 over-corrects if you like that look.

It takes a single images input and gives you a single IMAGE output, which wires straight into a Save Video, preview, or the next processing node.

Installing it

Same story as the rest of the pack: either ComfyUI Manager (search "ComfyUI-Fossiel-QoL-Nodes" or "Fossiel") or:

cd ComfyUI/custom_nodes
git clone https://github.com/Fossiel/ComfyUI-Fossiel-QoL-Nodes
pip install -r ComfyUI-Fossiel-QoL-Nodes/requirements.txt

Then restart ComfyUI and find it under Fossiel in the node menu. No model downloads - this is pure image math.

Where people get burned

One genuine gotcha: the requirements.txt lists Pillow, numpy, num2words, and webp - but not opencv-python, and this node imports cv2 at module load. If the whole pack refuses to load with ModuleNotFoundError: No module named 'cv2', that's why:

pip install opencv-python

Most ComfyUI installs already have OpenCV because a dozen other packs pull it in, which is probably why the author never noticed it was missing. And one expectation to set: it only fixes brightness flicker, not color cast or per-pixel noise. If your frames are pulsing in hue, this isn't the tool - look at a temporal color-match pass instead.

CategoryFossiel

Inputs (4)

NameTypeDefaultDescription
imagesIMAGE
window_sizeINT101–100
modeCOMBOmean2 options: mean, median
strengthFLOAT1.000–2

Outputs (1)

NameTypeDescription
IMAGEIMAGE