Nodes/ComfyUI-CustomNodePacks/AV Handles — Add / Trim
ComfyUI Node

AV Handles — Add / Trim

Add repeated frames at the head (or tail) to stabilise a video model, then trim exactly those back off afterwards — without retyping the number. In trim mode it uses the count the add recorded, so the two ends cannot drift apart. Audio is moved by the matching duration.

By Code2Collapse·Created 8 months ago·Updated about 2 hours ago· 58
AV Handles — Add / Trim
  • images
  • audio
  • handles
  • images
  • audio
  • total_frames
  • handles
  • info
◄modefit►
◄handle_frames8►
◄trim_amountauto►
◄target_frames0►
◄modelMiniMax H3 (17n+5)►
◄custom_step4►
◄custom_plus1►
◄sidehead►
◄padding_modedisabled►
◄manual_fps0.000►
◄memo_key►
Category🐺 C2C/🧰 Core/Video

Inputs (14)

NameTypeDefaultDescription
modeCOMBOfitfit — say how many frames you want OUT. The node works out what the model will accept, pads up to it, and remembers the target so the trim lands exactly there. This is the one to use. add — put a specific number of frames on, and remember how many. trim — take them back off, using the remembered target or count.
handle_framesINT80–400ADD: how many frames to put on. With a grid selected, 0 means 'just enough to land on the grid'. TRIM: ignored unless trim_amount is 'manual'.
trim_amountCOMBOautoTRIM mode only. auto — use the count the add side recorded (or the one wired into `handles`). This is the point of the node: the two ends cannot drift apart. manual — use handle_frames instead. Only for undoing handles this node did not add. It is a separate control because 'left at the default' and 'deliberately typed 8' cannot be told apart in one number, and guessing wrong silently trims the wrong amount.
imagesoptIMAGE—
audiooptAUDIO—
target_framesoptINT00–100000FIT mode: how many frames you want OUT. The model's own grid is an implementation detail — ask for 64 and you get 64, whatever the model needs to render to make them. 0 in fit mode means 'use the clip's current length as the target', which pads it to something the model accepts and trims straight back.
modeloptCOMBOMiniMax H3 (17n+5)Which model's frame grid to fit. Every video model wants step*n + plus frames and they disagree only on the numbers: H3 is 17n+5, Wan is 4n+1, LTX is 8n+1. Hand a model a count it does not accept and it does not complain — it reinterprets the clip, and the result comes out at the wrong speed.
custom_stepoptINT41–1000Only used when model is 'custom'.
custom_plusoptINT10–1000Only used when model is 'custom'.
sideoptCOMBOheadWhich end. Handles go on the head because that is the run a video model uses to settle; trim takes them off the same end.
padding_modeoptCOMBOdisabledRound the total onto a model's frame grid. A model that wants 4n+1 and is handed 4n does not complain — it reinterprets the clip, and the result comes out at the wrong speed.
manual_fpsoptFLOAT0.0000–2400 measures it from the clip's own audio. Set it when there is no audio to measure against — a guessed 30 on 24fps material puts the silence 25% out.
handlesoptHANDLESWire the add node's `handles` output here for an exact, explicit count. Takes priority over the remembered one, and works across separate workflows where the memory cannot.
memo_keyoptSTRINGOnly needed when two independent clips are being handled in one workflow — give each its own name so their counts do not overwrite each other. Empty is right for one clip.

Outputs (5)

NameTypeDescription
imagesIMAGEFrames, with handles added or removed.
audioAUDIOAudio moved by the same duration, so it stays in step.
total_framesINTHow many frames came out.
handlesHANDLESThe handle count, to wire into the trim node. Exact, and it does not depend on the memory — use it when the add and the trim are in different workflows.
infoSTRINGWhat happened, including WHERE the trim count came from.