VACE Source Prep
The trim node that keeps long clips from breaking your mask generator
- source_clip
- source_clip_2
- inpaint_mask
- trimmed_clip
- mode
- split_index
- edge_frames
- inpaint_mask
- keyframe_positions
- vace_pipe
Here's the situation that makes VACE Source Prep essential: you have a 274-frame clip and you want to extend it. Your VACE Mask Generator can't take it - for most modes the source must fit within target_frames (default 81), and if it doesn't, the mask generator errors out and tells you to trim first. Source Prep is that trim. It sits before the mask generator, looks at how long your clip is versus how many frames you're actually generating, and cuts the source down to the frames that matter for your chosen mode.
The name undersells it. It's not just a crop - it's a mode-aware parameter machine. It figures out the right trim for each of the eleven modes, recalculates the split_index and edge_frames that go with the trimmed clip, optionally trims your inpaint mask to match, and packages the whole thing plus a vace_pipe that tells the merge-back node exactly where the seams are. You wire its outputs straight into VACE Mask Generator and you can't accidentally hand it stale parameters.
How it works
You give it the full, untrimmed source_clip and the same mode you'll use downstream. The two inputs that do the trimming are input_left and input_right - frames to keep from each side of the split, where 0 means "keep all available." Their meaning shifts per mode: trailing context for End Extend, leading reference for Pre Extend, frames each side of the split for Middle Extend, edge sizes for Edge/Join, context around the region for Replace/Inpaint. Modes that don't trim (Frame Interpolation, Video Inpaint, Keyframe, Upscale) pass the clip through untouched.
Two details are worth knowing before they bite:
- Edge and Join modes force a symmetric trim - it takes the minimum of the left/right edge sizes, so you can't build an asymmetric loop context by accident.
- Join Extend takes an optional
source_clip_2to join two separate clips instead of splitting one in half - genuinely useful for stitching two takes together.
There's also per-mode widget hiding: inputs that don't apply to your selected mode disappear from the UI, which keeps a nine-input node from looking like a wall of knobs.
Outputs and the pipe
Seven outputs, and they split into two groups. trimmed_clip, mode, split_index, edge_frames, inpaint_mask, and keyframe_positions all wire into VACE Mask Generator's matching inputs - the adjusted values, not your raw ones. Then there's vace_pipe, a custom VACE_PIPE type carrying mode, trim bounds, and context-frame counts. That one doesn't go to the mask generator at all; it goes to VACE Merge Back, so the splice node knows where your trimmed window sat inside the original video. If you're only generating, you can ignore it. If you're splicing back, don't lose it.
How to install it
One of seven nodes in ethanfel's ComfyUI-VACE-Tools pack:
cd ComfyUI/custom_nodes/
git clone https://github.com/ethanfel/Comfyui-VACE-Tools.git
Restart ComfyUI, or search "VACE Tools" in ComfyUI Manager. Zero declared Python dependencies - just torch and numpy from ComfyUI itself - and no model downloads; the Wan base and VACE extension checkpoints are separate downloads in your WanVideoWrapper setup. The one thing to remember is the mode you select here must match the mask generator's mode. The node outputs mode precisely so you can wire it through instead of trusting yourself to keep two dropdowns in sync.
Inputs (9)
| Name | Type | Default | Description |
|---|---|---|---|
| source_clip | IMAGE | — | |
| mode | COMBO | End Extend | 11 options: End Extend, Pre Extend, Middle Extend, Edge Extend, Join Extend, Bidirectional Extend, +5 |
| split_index | INT | 0-10000–10000 | — |
| input_left | INT | 00–10000 | — |
| input_right | INT | 00–10000 | — |
| edge_frames | INT | 81–10000 | — |
| source_clip_2opt | IMAGE | Join Extend: second source clip to heal/join. Upscale: your reference image(s) at upscaled size — spliced into the clip at keyframe_positions before VACE processing. | |
| inpaint_maskopt | MASK | — | |
| keyframe_positionsopt | STRING | — |
Outputs (7)
| Name | Type | Description |
|---|---|---|
| trimmed_clip | IMAGE | Trimmed source frames — wire to VACE Mask Generator's trimmed_clip input. |
| mode | End Extend,Pre Extend,Middle Extend,Edge Extend,Join Extend,Bidirectional Extend,Frame Interpolation,Replace/Inpaint,Video Inpaint,Keyframe,Upscale | Selected mode — wire to VACE Mask Generator's mode. |
| split_index | INT | Adjusted split_index for the trimmed clip — wire to VACE Mask Generator. |
| edge_frames | INT | Adjusted edge_frames — wire to VACE Mask Generator. |
| inpaint_mask | MASK | Inpaint mask trimmed to match output — wire to VACE Mask Generator. |
| keyframe_positions | STRING | Keyframe positions pass-through — wire to VACE Mask Generator. |
| vace_pipe | VACE_PIPE | Pipe carrying mode, trim bounds, and context counts — wire to VACE Merge Back. |