ComfyUI Node

FrameMatch

Force any frame sequence to an exact length — no interpolation needed

By dseditor·Created about a year ago·Updated 7 months ago· 75
FrameMatch
  • images
  • images
target_frames100
fill_moderepeat_last

Video nodes in ComfyUI are picky about lengths: many want exactly N frames, and when your source renders 92 frames but the combiner needs 100, the mismatch shows up as a skipped tail or a duplicated frame somewhere random. FrameMatch is the duct tape for that - it resizes any image sequence to a target frame count using duplication and truncation, no interpolation, no motion blur, no surprises. If your audio says the clip should be 342 frames and your model produced 340, this pads it to 342 and the timeline lines up.

How it works

The node takes your images batch and target_frames and does one of three things:

  • If the sequence is already the right length, it passes through untouched.
  • If it's too long, it truncates to the first target_frames frames.
  • If it's too short, it fills the gap according to fill_mode:
    • repeat_last (default) - holds the final frame. The safe, invisible choice for holding a scene on its last pose.
    • loop - cycles the whole sequence to fill, like a GIF.
    • bounce - plays forward then backward (ping-pong), which loops more smoothly than a hard cycle for motion like swaying or pulsing.

The tooltips say it plainly: repeat-last for holding, loop for cycling, bounce for back-and-forth motion. Because it only duplicates existing frames (never blends them), the output stays crisp and the motion remains exactly what your video model generated.

Inputs and output

  • images - the frame sequence (a batch IMAGE, N×H×W×C).
  • target_frames - the exact count you need (1–10,000, default 100).
  • fill_mode - how to make up the difference.

One output: images (IMAGE), the resized sequence. Because it's a pure length transform, you can drop it inline between a video-model output and a combiner.

Installing it

cd ComfyUI/custom_nodes
git clone https://github.com/dseditor/ComfyUI-ListHelper

Restart ComfyUI; find it under ListHelper/Tools. No dependencies beyond the pack base. ComfyUI Manager: search "ComfyUI-ListHelper".

The honest take

The reason this node is worth having is that "pad to exact length" is exactly what audio-synced pipelines need - it's the natural partner to the pack's Audio to Frame Count, which tells you the target. One caveat: it can only duplicate or drop frames, so repeat_last on a long stretch will visibly freeze the last frame, and truncating chops the tail. That's a feature for sync, not a bug - if you wanted smooth motion synthesized in between, you'd reach for a frame-interpolation node instead. For making your render length match the soundtrack, this is the one-liner that just works.

CategoryListHelper/Tools

Inputs (3)

NameTypeDefaultDescription
imagesIMAGE
target_framesINT1001–10000目標幀數
fill_modeoptCOMBOrepeat_last填充模式:repeat_last=重複最後一幀,loop=循環播放,bounce=來回播放

Outputs (1)

NameTypeDescription
imagesIMAGE