Nodes/ComfyUI-ChunkedSampling/Flux Video Cleanup Temporal Advanced
ComfyUI Node

Flux Video Cleanup Temporal Advanced

Clean up a video without turning it into a strobe light

By xmarre·Created 5 months ago·Updated 5 months ago· 0
Flux Video Cleanup Temporal Advanced
  • images
  • vae
  • noise
  • guider
  • sampler
  • sigmas
  • warped_previous_images
  • flow_confidence
  • images
  • latents
  • denoised_latents
  • reset_mask
temporal_mode
temporal_strength0.20
reset_every_n0
scene_cut_threshold0.18
flow_confidence_scale1.00
lock_seedtrue
seed_stride_mode
encode_chunk_size8
sample_chunk_size1
decode_chunk_size8
auto_reduce_on_oomtrue
min_chunk_size1
clear_cache_on_retrytrue
clear_cache_between_chunksfalse

Here's the classic video cleanup trap: you take a video, re-sample each frame through an img2img pipeline to denoise it or scrub artifacts, and the output looks like someone hit the strobe light. Every frame looks fine on its own; played back, they shimmer and crawl because each one was generated in isolation. This node exists to break that isolation - it re-samples a video one frame at a time, but feeds each frame's previous cleaned output back in, so the cleanup stays temporally coherent.

You hand it an IMAGE batch of frames plus the standard custom-sampling pieces (noise, guider, sampler, sigmas) and a vae. In any mode other than off, it stops treating the batch as a batch and runs a per-frame loop where frame t can depend on frame t-1.

How it works

The trick is a "temporal prior" built in pixel space before the VAE encode. The node blends the current input frame with something that remembers the past, encodes that, samples, decodes, and moves on. temporal_mode picks what "something" is:

  • prev_output_blend - blend the current frame with the previous cleaned output. Simple, zero extra dependencies, and the sensible starting point.
  • external_warped_prev - blend with a warped previous image you provide via the optional warped_previous_images input, so motion compensation can come from your own optical-flow or warp nodes.
  • internal_flow_warp - computes optical flow internally (OpenCV Farneback) and warps the previous cleaned output before blending. Convenient, but it requires cv2 in your ComfyUI Python environment - without it, this mode raises an error. ComfyUI often has OpenCV around via other packs, but don't assume.
  • off - pure batch path, no recurrence; the node behaves like the chunked batch chain.

temporal_strength (default 0.2) sets how much of the prior bleeds into the current frame. reset_every_n and scene_cut_threshold (default 0.18) are the escape hatches: they force a hard reset on the recurrence - the latter whenever a frame differs enough from the previous one that it's clearly a scene cut. That matters, because a scene cut is exactly where you don't want last frame's output smeared into the new shot. The reset_mask output marks which frames got reset, which is genuinely useful for debugging why a transition looks off.

Seeding is worth a sentence: with lock_seed on (default), every frame gets a seed derived from your NOISE input's seed - seed_stride_mode fixed gives the same seed per frame, sequential adds the frame index. With lock_seed off, the node lets frame-indexed noise variation do its thing.

The inputs that matter

  • temporal_mode - the only choice that changes behavior fundamentally. Start with prev_output_blend.
  • temporal_strength - keep it modest (~0.2). Too high ghosts and smears; too low, the flicker creeps back. This is the knob you'll tune all day.
  • scene_cut_threshold - leave at 0.18 unless you see wrong resets.

Note the tooltips on sample_chunk_size, auto_reduce_on_oom, min_chunk_size, and clear_cache_on_retry: they only do anything when temporal_mode is off. Temporal recurrence always samples one frame at a time, so those knobs are dead weight outside the batch path.

Outputs: images (the cleaned frame stack, ready for a Save/Preview), latents and denoised_latents (per-frame latents if you want to chain something on), and reset_mask.

Installing it

Ships in the xmarre/ComfyUI-ChunkedSampling pack. ComfyUI Manager: search "ComfyUI-ChunkedSampling". Or:

cd ComfyUI/custom_nodes
git clone https://github.com/xmarre/ComfyUI-ChunkedSampling

Restart ComfyUI. No requirements.txt and no model downloads - the pack is genuinely dependency-light. The only optional piece is cv2 for internal_flow_warp.

Gotchas

The big one is speed: temporal modes run the full sampler once per frame, so a 100-frame clip is 100 denoising runs, plus a VAE encode and decode per frame. Budget accordingly. Also remember this is a pixel-space temporal prior, not per-frame conditioning rewrite - it keeps results coherent but it isn't magic, and heavy motion is where it strains. The pack is small and new with little community footprint, so treat settings like defaults to tune, not gospel. Start at prev_output_blend at strength 0.2, check a short clip, then decide if you need the flow-warp machinery at all.

Categorysampling/custom_sampling

Inputs (22)

NameTypeDefaultDescription
imagesIMAGE
vaeVAE
noiseNOISE
guiderGUIDER
samplerSAMPLER
sigmasSIGMAS
temporal_modeCOMBO4 options: off, prev_output_blend, external_warped_prev, internal_flow_warp
temporal_strengthFLOAT0.200–1
reset_every_nINT00–4096
scene_cut_thresholdFLOAT0.180–1
flow_confidence_scaleFLOAT1.000–1
lock_seedBOOLEANtrue
seed_stride_modeCOMBO2 options: fixed, sequential
encode_chunk_sizeINT81–4096
sample_chunk_sizeINT11–4096Only used when temporal_mode is off. Temporal recurrence forces per-frame sampling.
decode_chunk_sizeINT81–4096
auto_reduce_on_oomBOOLEANtrueOnly used when temporal_mode is off. Temporal recurrence always samples one frame at a time.
min_chunk_sizeINT11–4096Only used when temporal_mode is off. Temporal recurrence always samples one frame at a time.
clear_cache_on_retryBOOLEANtrueOnly used when temporal_mode is off. Temporal recurrence does not use chunk-size retry fallback.
clear_cache_between_chunksBOOLEANfalse
warped_previous_imagesoptIMAGE
flow_confidenceoptMASK

Outputs (4)

NameTypeDescription
imagesIMAGE
latentsLATENT
denoised_latentsLATENT
reset_maskMASK