Extensions/Muse Color Match (Batched)
ComfyUI Extension

Muse Color Match (Batched)

Batched, memory-bounded replacement for KJNodes' ColorMatchV2 — processes long video sequences a few frames at a time instead of holding the whole batch (and color_matcher's internal float64 copies of it) in RAM at once. Same color_matcher library and methods under the hood, drop-in compatible with ColorMatchV2's method/strength/multithread behavior.

By muse-collective-26·Created about a month ago·Updated about a month ago· 0
muse-collective-26/muse-collective-batched-colour-match
Nodes
On cloudLocal install
Stars0
Updatedabout a month ago
Readme

Muse Color Match (Batched)

Drop-in replacement for KJNodes' ColorMatchV2 for long video sequences (hundreds/thousands of frames).

Why this exists

ColorMatchV2 processes every frame through a thread pool, keeps every result alive in a Python list, then torch.stack()s the entire list at the end. Separately, the color_matcher library's own Normalizer unconditionally upcasts every frame to float64 internally regardless of input dtype. Combined, the final stack briefly holds the entire video at float64, right before downcasting back to float32 — for a few thousand 1080p+ frames that's tens of extra GB on top of what the final video actually needs, which is what crashes long runs.

This node processes a handful of frames at a time, forces each result back to float32 immediately (per-frame, not once at the end), and writes directly into a single preallocated output tensor instead of ever building a second full-length list/stack.

What it does not solve

The final IMAGE tensor this node returns is still one contiguous batch of every frame, at whatever output_precision you choose (~51GB at float32 or ~25.5GB at float16 for 2040 frames at 1088x1920). Batching removes the large temporary overhead stacked on top of that — it does not make an arbitrarily long video free to hold in RAM.

Inputs

  • images / reference — same as ColorMatchV2. Reference indexing matches the original: a single reference frame is reused for every source frame; a reference batch the same length as images is matched 1:1; a shorter reference batch clamps to its last frame.
  • methodmkl, hm, reinhard, mvgd, hm-mvgd-hm, hm-mkl-hm (the real methods color_matcher supports; excludes kjnodes' separate GPU/Kornia-only reinhard_lab_gpu path, which isn't part of this library).
  • strength — same blend-toward-original behavior as ColorMatchV2.
  • batch_size — frames processed (and held in memory) at once. 2-4 recommended for 1080p+.
  • workers — thread pool size. Default 1; each additional worker holds its own float32 source frame + color_matcher's internal float64 intermediates + result array simultaneously, so more workers trades memory for speed.
  • output_precisionmatch_input / float16 / float32. float16 recommended for long videos.
  • cleanup_between_batches — run gc.collect() after each batch.

Recommended defaults for long 1080p+ runs

method=mkl, batch_size=2, workers=1, output_precision=float16, cleanup_between_batches=true