Nodes/Difforum/Difforum · Flow Stabilize
ComfyUI Node

Difforum · Flow Stabilize

Kill the Flicker Without Ghosting the Motion

By chillithebillis·Created 4 months ago·Updated 11 days ago· 10
Difforum · Flow Stabilize
  • frames
  • frames
◄strength0.50►
◄flow_scale0.50►
◄error_gate0.15►

Flicker is the signature defect of feedback animation. Every frame gets re-rolled by the sampler, so texture boils, grain crawls, and small details pop in and out of existence. Anyone who has watched a Deforum clip knows the look, and anyone who has tried to fix it with a frame blend knows the cure is usually worse: blend two frames and every moving edge doubles.

This node does the version that doesn't ghost. It aligns the previous stabilized frame onto the current one along dense optical flow first, then blends only where that alignment is photometrically trustworthy.

How it works, concretely

Motion is estimated with OpenCV's Farneback dense flow, computed at reduced scale for speed (flow_scale 0.5 by default, 1.0 for precision). The previous frame is warped onto the current one along that flow with a torch grid sample. Then a trust check: where the flow estimate is unsure - occlusions, new content appearing, the parts of the frame where the model just invented something - the blend turns off and the frame passes through untouched.

That error gate is the whole idea. Naive temporal smoothing assumes every pixel moved predictably; this one assumes nothing and checks.

The three inputs

  • strength (0.5) - how much history is blended in along motion. The tooltip's range is useful guidance: 0.3–0.5 calms boiling texture, and 0 is off. Past 0.5 you're into smoothing territory where fast motion starts to feel viscous.
  • flow_scale (0.5) - resolution of the motion estimate. 0.5 is fast, 1.0 is precise. On a 2-second loop, use 1.0 and don't think about it. On a 60-second 2K clip, start at 0.5.
  • error_gate (0.15) - where the motion estimate is unsure, blending turns off. Lower is safer (less blending, less risk of smearing), higher is stronger smoothing. This is the dial to reach for when flicker survives a strength increase: raising strength with a tight gate mostly does nothing, because most of the frame is being excluded.

Output

frames. It's a pass-through node in shape - a clip in, a clip out - so it slots between your render and your save, and it can just as happily sit after a video-model output as after a Feedback render.

Install

ComfyUI Manager → search "Difforum", or:

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

Restart. This is the one Difforum node that genuinely needs OpenCV - pip install opencv-python. The import is lazy and the node raises a clear error rather than crashing the whole pack, but if you're on a minimal install, that's the wheel to add. It's also used by the Loop node's flow crossfade and by the Live Sampler's webcam input, so it's worth having anyway.

Where people get burned

Treating it as a fix for bad renders rather than the last 10%. Flow Stabilize cleans up texture boil on a good clip. It does not rescue a clip where the model is inventing a new subject every four frames - there's no consistent motion for the flow to follow, so the gate correctly refuses to blend and you've spent a render pass for nothing.

Also, cost. Farneback at 1.0 scale on a long clip in 2K is not free, and it's CPU work - the flow is OpenCV on numpy, the warp is torch. On a two-minute piece you'll feel it. Estimate at 0.5, run the final at 1.0 if the difference is visible, which on most feedback footage it isn't.

CategoryDifforum/7 · Post

Inputs (4)

NameTypeDefaultDescription
framesIMAGEA batch of frames (a clip).
strengthFLOAT0.500–0.95How much history is blended in along motion. 0.3-0.5 calms boiling texture; 0 = off.
flow_scaleFLOAT0.500.25–1Resolution of the motion estimate. 0.5 = fast, 1.0 = precise.
error_gateFLOAT0.150.02–0.5Where the motion estimate is unsure (occlusions, new content), blending turns off. Lower = safer, higher = stronger smoothing.

Outputs (1)

NameTypeDescription
framesIMAGE—