XB_WanFunInpaintToVideo
Bookend-pinned editing for Wan 2.2
- positive
- negative
- vae
- clip_vision_output
- start_image
- end_image
- positive
- negative
- latent
Wan 2.2 Fun Inpaint is the "edit this bit of my video" model - you tell it what's already there and what should change, and it regenerates only what needs regenerating. XB_WanFunInpaintToVideo is the XB_ToolBox pack's conditioning wrapper for it, and it's a refreshingly small node: it takes the usual positive/negative conditioning plus a vae, builds the latent, and lets you pin a start_image and an end_image as the two bookends of the edit. Outputs are positive, negative and latent, ready for the sampler.
If it looks familiar, that's because it is - under the hood this node literally calls the pack's XB_WanFirstLastFrameToVideo processor with your start and end images. The Fun Inpaint flavor of Wan shares the first/last-frame conditioning pattern with plain FLF, so the pack reuses the code rather than duplicating it. That's a good sign for correctness, even if it means this node is less "special" than its name suggests.
How it works
The node builds a latent at width × height × length, then VAE-encodes your start and end images into a concat_latent_image and stamps both conditioning paths with a concat_mask that zeroes out those frames. The sampler is told "these frames are already decided" and only gets to invent the motion between them - which is exactly the contract you want when you're editing a specific segment of a longer take and need the result to slot back into place.
Optional clip_vision_output (a CLIP Vision encode of your subject) gets attached to the positive side to hold identity across the edit. scale_method and crop_mode control how your images are fitted to the target resolution.
Inputs that matter
Defaults are landscape (832×480), 81 frames, vae_tile_size 64. The inputs doing the actual work: start_image (the state your clip starts in) and end_image (where it should land). The middle - what actually changes - is driven by your positive/negative prompts and the masking you do elsewhere in the graph. That's the honest caveat: this node does the conditioning, not the inpainting mask. The "what stays, what goes" logic lives in the rest of your Fun Inpaint workflow, and the model gets the region information from its own Fun Inpaint architecture once you've set the conditioning up right.
Install & context
Standard for the pack: ComfyUI Manager → XB_ToolBox, or:
cd ComfyUI/custom_nodes
git clone https://github.com/wjluoxiao/XB_ToolBox.git
restart. Declared deps: opencv-python, easyocr. You'll want a Wan2.2-Fun-Inpaint checkpoint plus the usual Wan VAE/CLIP/T5. Expect a 14B model's runtime - budget for it and bring a speed-LoRA/CFG-1.0 setup if you're iterating.
Inputs (13)
| Name | Type | Default | Description |
|---|---|---|---|
| positive | CONDITIONING | — | |
| negative | CONDITIONING | — | |
| vae | VAE | — | |
| width | INT | 83216–8192 | — |
| height | INT | 48016–8192 | — |
| length | INT | 811–8192 | — |
| batch_size | INT | 11–4096 | — |
| vae_tile_size | INT | 6464–3840 | — |
| clip_vision_outputopt | CLIP_VISION_OUTPUT | — | |
| start_imageopt | IMAGE | — | |
| end_imageopt | IMAGE | — | |
| scale_methodopt | COMBO | lanczos | 5 options: lanczos, bilinear, bicubic, nearest-exact, area |
| crop_modeopt | COMBO | center | 2 options: center, disabled |
Outputs (3)
| Name | Type | Description |
|---|---|---|
| positive | CONDITIONING | — |
| negative | CONDITIONING | — |
| latent | LATENT | — |