Nodes/ComfyUI-Image-Filters/Batch Normalize (Latent)
ComfyUI Node

Batch Normalize (Latent)

Stop your video batch from flickering

By spacepxl·Created 3 years ago·Updated 8 months ago· 293
Batch Normalize (Latent)
  • latents
  • LATENT
factor1.00

Frame flicker is one of those problems that's specific to batch and video generation and doesn't really have an equivalent in single-image work: each frame in a batch can get denoised with its own slight variation, and even when the content is consistent, the overall brightness can drift frame to frame - a subtle pulsing or flickering that's obvious in motion even though any single frame looks fine on its own. It's the same broad family of problem as the batch-boundary flickering people report with video upscalers that process in chunks - a mismatch in overall statistics between segments that weren't generated as one continuous whole. Batch Normalize (Latent) is a fix aimed at that: normalize every frame to the batch's overall statistics, and the frame-to-frame brightness variation goes away.

How it works

It computes the mean and standard deviation across the whole batch - not per-frame, the overall statistics - and then normalizes each individual frame's latent to match that overall baseline. Any frame that's drifted brighter or darker than the batch average gets pulled back toward it. Because this operates on the shared, whole-batch statistic rather than matching each frame to some external reference, it specifically targets flicker (frame-to-frame inconsistency within one generation) rather than color correction against an external source, which is what the AdaIN nodes in this same pack are for.

Inputs and outputs that matter

  • latents - your batch of latents, pre-decode.
  • factor (-10 to 10, default 1) - how strongly the normalization is applied. 1 is full correction; lower values blend partway if a full normalize overcorrects and flattens intentional variation you wanted to keep.

Output: a single LATENT batch, same shape as the input, ready to continue to VAE decode.

Installing it

Through ComfyUI Manager, search ComfyUI Image Filters. Manually:

cd ComfyUI/custom_nodes
git clone https://github.com/spacepxl/ComfyUI-Image-Filters

Restart. Pure tensor statistics - no models to fetch. The one dependency issue that shows up across this whole pack is opencv version conflicts with other installed node packs; fix it with the repo's import_error_install.bat, or by hand, uninstall the opencv-* variants and keep only opencv-contrib-python.

Where people get burned

This fixes overall brightness flicker specifically - it won't fix flicker that comes from actual content changes, like a light source flickering in the scene you generated, or genuinely inconsistent detail between frames. If you normalize and the flicker is still there, look at what's actually varying: if it's structural rather than a simple brightness drift, this node isn't the tool.

Also worth knowing: because this normalizes to the batch's own average, it can't fix a batch that's uniformly wrong in the same direction - every frame too dark, say. That's not flicker, that's a consistent bias, and normalizing to the batch average won't correct it since the average itself is off. Exposure Adjust, elsewhere in this pack, is the tool for a consistent brightness problem; Batch Normalize (Latent) is specifically for inconsistency between frames.

CategoryImage-Filters/latent

Inputs (2)

NameTypeDefaultDescription
latentsLATENT
factorFLOAT1.00-10–10

Outputs (1)

NameTypeDescription
LATENTLATENT