AV Handles (Trim)
AV Handles (Trim)
- images
- audio
- images
- audio
- remaining_frames
- info
If you read the AV Handles (Add) article, you know the drill: video models like WAN S2V and LTX2 produce better output if you pad a few copies of the first frame in front of your sequence, run the model, and then throw the padding away. AV Handles (Trim) is the throwing-away half - the boring half, but the half that's easy to get wrong if you do it by hand. Skip it, and your final video has a frozen first-frame intro nobody asked for, plus trailing silence if audio is involved. This node cuts both cleanly.
What it does: it strips handle_frames frames off the front of your image batch and the matching amount of silence off the front of your audio. That's it. But "matching" is doing a lot of work there, because the count has to line up with what the Add node actually inserted.
How it works: images get sliced with images[handle_frames:] - a plain tensor slice, no re-encoding. For audio, it computes how many samples to remove (handle_frames / fps × sample_rate) and drops them off the front. Like its partner, it auto-detects FPS from your frame count and audio duration, or you can set manual_fps for oddball framerates and audio-only work. It also validates before cutting: ask it to trim 12 frames from a 10-frame clip and it raises "Cannot trim 12 frames from sequence of 10 frames" instead of silently returning nonsense.
The inputs that matter:
handle_frames(required, default 8, 0–100) - how many frames to remove.manual_fps(default 0 = auto-detect) - must match what you used on the Add node.
The rest are pass-throughs: images and audio in, images and audio out. The extra outputs are remaining_frames (handy for sanity-checking) and info, which tells you what was trimmed and even flags whether the remaining count is WAN or LTX2 compatible.
The whole point of this node's design: you normally don't type a number into handle_frames at all. You wire the Add node's handles_added output into it. This matters once you enable padding_mode rounding on the Add side - WAN rounds up to 4n+1 frame counts, LTX2 to 8n+1, so the real number of frames added is whatever it rounds to, not what you typed. Hand-counting that across a workflow is a recipe for a video that's a few frames too long and audio that's silently off. Letting the Trim node read the actual count from the Add node is the automatic-sync path, and it's the one you want.
Install: identical to the Add node - it's the same pack, so you install once and get both.
cd ComfyUI/custom_nodes
git clone https://github.com/pizurny/ComfyUI-AV-Handles.git
# restart ComfyUI
Or just search "AV Handles" in ComfyUI Manager. No model downloads, no extra dependencies - torch only, MIT licensed. Both nodes appear under video/handles.
Troubleshooting: the classic error is "Cannot trim X frames from sequence of Y frames" - almost always a mismatch between what Add inserted and what Trim is asked to remove, which the handles_added wiring eliminates. Set handle_frames to 0 and the node is a fast no-op passthrough, which is handy for A/B testing whether the warm-up trick is even helping you. And as with the Add node, if audio-only mode gives you unexpected durations, you forgot manual_fps on both sides. The tooltips on the inputs spell this out too - the author knew where people get stuck.
Inputs (4)
| Name | Type | Default | Description |
|---|---|---|---|
| handle_frames | INT | 80–100 | — |
| imagesopt | IMAGE | — | |
| audioopt | AUDIO | — | |
| manual_fpsopt | FLOAT | 0.000–120 | Manual FPS override (0 = auto-detect from video/audio) |
Outputs (4)
| Name | Type | Description |
|---|---|---|
| images | IMAGE | — |
| audio | AUDIO | — |
| remaining_frames | INT | — |
| info | STRING | — |