ComfyUI Node

Frame Adjuster

Frame Adjuster

By zhangp365·Created 2 years ago·Updated 5 months ago· 134
Frame Adjuster
  • images
  • masks
  • images
  • frame_count
  • fps
  • masks
duration5.0
fps24
remove_frames0
extend_tail_frame_if_adjustfalse
frame_count0

Video pipelines built out of multiple generation steps rarely agree on frame count. A hosted i2v model might hand you back 81 frames, your next step wants a specific duration, and stitching clips from different sources together means reconciling frame counts that were never meant to match. FrameAdjuster is the glue node for that: it trims or extends a frame sequence to hit a target, and adjusts its reported duration/fps accordingly, without you writing custom frame-manipulation logic yourself.

Inputs that matter: images is your input frame sequence, required, along with duration (seconds, default 5) and fps (default 24) - together these describe the timing you want the output to represent. remove_frames (default 0, up to 20) trims that many frames, useful for cutting a flawed lead-in or trailing frame that a generation model tacked on (a common artifact at clip boundaries when chaining generations together). frame_count (optional, default 0) lets you target an exact frame count directly rather than deriving it purely from duration and fps. extend_tail_frame_if_adjust (off by default) controls what happens when the math needs more frames than you actually have: with it on, the node repeats the last frame to pad out to the target length instead of leaving you short. masks is optional - if your frame sequence has an associated mask stream, this node carries it through the same trim/extend logic rather than making you handle it separately.

Outputs: images (the adjusted sequence), frame_count, fps, and masks - the adjusted mask stream if you supplied one going in.

Install: search "ComfyUI-utils-nodes" in ComfyUI Manager, or:

cd ComfyUI/custom_nodes
git clone https://github.com/zhangp365/ComfyUI-utils-nodes

Restart ComfyUI. Pure frame manipulation - no models, no API calls, nothing external.

Common gotchas:

  • remove_frames trims from wherever the node's internal logic decides (per the README, this is a trimming operation, not a "remove from start" or "remove from end" explicit choice) - preview your output after adjusting rather than assuming which end got cut, especially if the trimmed frames matter to you.
  • extend_tail_frame_if_adjust padding by repeating the last frame is a reasonable fallback but produces a visibly frozen moment at the end of your clip if you need more length than you actually generated - it's a stopgap for small gaps, not a substitute for generating enough frames in the first place. If you need meaningfully more footage, go back and generate a longer clip rather than leaning on this to stretch a short one.
  • duration/fps/frame_count can all imply different targets if you set them inconsistently - since frame_count lets you override what duration × fps would otherwise calculate, double-check which one is actually driving the output on a given run rather than assuming they're always in sync.
  • If you're feeding masks through alongside images, make sure the mask sequence actually has the same original frame count as the image sequence before this node adjusts both - a mismatch going in will produce a mismatch (or an outright error) coming out.
Categoryutils

Inputs (7)

NameTypeDefaultDescription
imagesIMAGE
durationFLOAT5.00.1–60
fpsFLOAT241–120
remove_framesINT00–20
extend_tail_frame_if_adjustoptBOOLEANfalse
frame_countoptINT0
masksoptMASK

Outputs (4)

NameTypeDescription
imagesIMAGE
frame_countINT
fpsFLOAT
masksMASK