Nodes/sweet-tea-nodes/Wan VACE → Video (caps inpaint)
ComfyUI Node

Wan VACE → Video (caps inpaint)

Cap-stitch inpainting for Wan VACE

By tea-time-labs·Created 6 months ago·Updated 17 days ago· 0
Wan VACE → Video (caps inpaint)
  • positive
  • negative
  • vae
  • control_video
  • reference_image
  • positive
  • negative
  • latent
  • trim_latent
width832
height480
length81
batch_size1
strength1.00
start_control_frames24
end_control_frames24
ref_strength-1.00
ctrl_strength-1.00
ref_noise_std0.00

You've got the start of a clip and the end of a clip, and you need the model to bridge them. That's the whole pitch of this node: it treats your start and end frames as known, preserved regions and forces Wan VACE to generate the middle. In the pack's own words, it's a "cap-stitch" inpaint node for hard clip joins and transition reconstruction.

If you've worked with VACE at all, you know the context: it's Alibaba's Video-Aware Context Extension for Wan, and it's become the community's standard way to do vid2vid, inpainting, and extension control. The usual VACE workflow feeds a full-length control video in. This node is different - it's a specialized encoder that bakes the caps-inpaint semantics in, so you don't hand-craft a control video with a masked-out middle. You give it the caps, it does the rest.

How it works

The node builds a length-T control timeline. Your start cap goes in frames [0 : start_control_frames], your end cap in [length - end_control_frames : length], and the middle is forced to a neutral RGB 0.5 gray. That neutral filler isn't cosmetic - the WAN VAE encodes RGB nonlinearly, so any real color hiding in the "filler" region becomes evidence the model can read. Gray is maximally non-informative, which is exactly what you want in a region that's supposed to be generated, not observed.

Then it builds the VACE mask with proper inpainting semantics: mask 0 = known/preserve (your caps stay crisp - the model isn't allowed to denoise them), mask 1 = unknown/generate (the middle is genuinely denoised, not fogged or passthrough-decoded). It encodes the two control "plates" (inactive and reactive, split around the 0.5 center), packs the mask into VACE's stock 64-channel spatial layout with temporal nearest-exact resampling for crisp boundaries, and attaches vace_frames, vace_mask, and vace_strength to both your positive and negative conditioning. The latent it hands you is a zeroed 16-channel stub - the sampler fills it in.

Inputs and outputs that matter

  • length (81), width (832), height (480) - your output clip geometry.
  • start_control_frames (24) and end_control_frames (24) - how many frames of each cap are preserved. The README notes the node supports variable lengths and cap sizes.
  • control_video (optional) - can be any length; only the first start_control_frames and last end_control_frames frames are read. Omit it entirely for pure middle-generation.
  • strength (1.0), plus optional reference_image, ref_strength, ctrl_strength (both default -1, meaning "mirror the global strength"), and ref_noise_std.

Outputs: positive and negative conditioning and a latent - all three into your KSampler - plus trim_latent (an INT: how many leading latent frames to trim after decode; it's 1 if you passed a reference image, else 0). Wire trim_latent into your trim/decode step so the reference frame doesn't render as a stuck first frame.

Install

Same pack - ComfyUI Manager, search Sweet Tea Nodes, restart, or clone the repo into custom_nodes. It needs a Wan model with VACE support and its VAE; the only pip dependency is tqdm. Do set expectations: VACE is slow. The knowledge base pegs Wan 2.1 VACE 14B at 15–40 minutes on a 4090 depending on resolution and frame count. Kijai's CausVid distillation LoRA (2–4 steps at CFG 1.0) is the usual speed fix.

Common issues

This is marked experimental, and it's a brand-new node from a small pack - there's no community troubleshooting corpus yet, so expect to be the first person to hit whatever you hit. Grounded gotchas: keep length >= start_control_frames + end_control_frames (they clamp, but you'll lose cap), remember only the middle is generated - a short middle with long caps is nearly a pinned clip, which is the design, not a bug - and if the caps drift or blur, raise start_control_frames/end_control_frames or check your control_video ordering (start is read from the beginning, end from the end).

Categoryconditioning/video_models

Inputs (15)

NameTypeDefaultDescription
positiveCONDITIONING
negativeCONDITIONING
vaeVAE
widthINT83216–16384
heightINT48016–16384
lengthINT811–16384
batch_sizeINT11–4096
strengthFLOAT1.000–1000
start_control_framesINT240–100000
end_control_framesINT240–100000
control_videooptIMAGE
reference_imageoptIMAGE
ref_strengthoptFLOAT-1.00-1–1000
ctrl_strengthoptFLOAT-1.00-1–1000
ref_noise_stdoptFLOAT0.000–2

Outputs (4)

NameTypeDescription
positiveCONDITIONING
negativeCONDITIONING
latentLATENT
trim_latentINT