Nodes/comfyui-mini-nodes/mini_video_color_match
ComfyUI Node

mini_video_color_match

Grade a whole video from two stills — and ramp the strength in and out over a frame range

By catmaxzj·Created 4 months ago·Updated 2 days ago· 28
mini_video_color_match
  • target_video
  • target_image
  • ref_image
  • target_mask
  • ref_mask
  • video
methodLinear
start_frame1
start_strength1.00
end_frame-1
end_strength1.00

Color-matching a video is where naive per-frame matching falls apart: you compute a transform for every frame independently, the statistics wobble frame to frame, and the result flickers like a bad fluorescent light. mini_video_color_match avoids that the smart way - it computes the color transform once, from two still images you point it at, then applies that single locked transform to the whole clip. One grade, stable across every frame, no temporal jitter.

The pack added this in v1.0.4 alongside the existing image node, and it's the one to reach for when your clip has a color shift you need to correct without re-running a video model. Classic case: you generated a video, one segment drifts in white balance, or you're compositing footage that needs to sit in a reference's grade.

How it works

You feed it the video to grade (target_video, a batch of frames), plus two anchor stills: target_image (the "before" reference) and ref_image (the look you want). It samples pixels from those two stills, computes the transform once, and applies it to every frame of the clip in one vectorized pass. Because the transform never changes, you get perfect temporal consistency - that's the entire point of the anchor design.

Then the interesting part: start_frame, start_strength, end_frame, and end_strength build a piecewise-linear strength ramp. Before the start frame, the effect sits at start_strength; after the end frame, at end_strength; between them it fades linearly. Set start_strength to 0 and end_strength to 1 over a few frames and the grade eases in instead of slamming on. end_frame defaults to -1, which means "last frame" - so by default the ramp runs the whole clip.

The inputs that matter

  • target_video - the frame batch to grade. This is what gets transformed.
  • target_image / ref_image - single anchor stills. Only the first frame of each is used (extra frames get a console warning and are ignored), and the stats come from these two, so pick a representative frame for the "before."
  • method - Linear, Mean, or MKL. Same math as the image sibling: Linear for masked per-channel matching, Mean for a contrast-preserving shift, MKL for unmasked global mapping. Note there's no Wavelet here - this node keeps the three statistical methods.
  • start_frame / end_frame - the ramp range, 1-indexed. end_frame -1 = the clip's last frame.
  • start_strength / end_strength - 0.0–1.0, default 1.0.

Optional target_mask and ref_mask exist and work like the image node's - each is a single-frame mask applied to its corresponding anchor still, so you can restrict the statistics to, say, just the skin or just the sky in both frames.

The output is a single IMAGE batch named video - wire it straight into a video preview node or VHS_VideoCombine to render it out.

Install

Same pack, same story:

cd ComfyUI/custom_nodes
git clone https://github.com/catmaxzj/comfyui-mini-nodes

or ComfyUI Manager → search "comfyui-mini-nodes" → install, then restart. No dependencies beyond what ComfyUI ships.

Gotchas

  • If the anchor masks sample fewer than 50 pixels, the node skips grading entirely and returns the video unchanged, with a console warning. An all-black or wrong-resolution mask silently does nothing - check the terminal output if your grade isn't landing.
  • The anchors define the grade. A bad target_image frame (motion blur, wrong exposure moment) poisons the whole clip. Spend the two seconds picking a clean representative frame.
  • The ramp is linear, not eased. If the transition looks mechanical, split the difference - grade once with a short ramp and again with the opposite direction to approximate a curve, or just accept that a straight fade usually reads fine.
  • Frames before start_frame hold start_strength, frames after end_frame hold end_strength, and if end_frame is set before start_frame, the whole clip just uses start_strength. Set the range deliberately.
Categorymini_nodes

Inputs (10)

NameTypeDefaultDescription
target_videoIMAGE
target_imageIMAGE
ref_imageIMAGE
methodCOMBOLinearLinear: 遮罩校色,RGB独立缩放,色彩参考最直接 Mean: 遮罩校色,平移均值保留原图对比度 MKL: 无遮罩,通用全局映射,快捷校色最方便
start_frameINT11–999999
start_strengthFLOAT1.000–1
end_frameINT-1-1–999999-1 表示视频最后一帧
end_strengthFLOAT1.000–1
target_maskoptMASK
ref_maskoptMASK

Outputs (1)

NameTypeDescription
videoIMAGE