Nodes/ComfyUI-RGnodes/VACE Inpaint Keyframe Insert
ComfyUI Node

VACE Inpaint Keyframe Insert

Drop up to five hand-made keyframes into a VACE video at exact frame positions

By rgamevfx·Created 7 months ago·Updated 7 months ago· 3
VACE Inpaint Keyframe Insert
  • images
  • masks
  • keyframe_1
  • keyframe_2
  • keyframe_3
  • keyframe_4
  • keyframe_5
  • images
  • masks
keyframe_positions0
keyframe_mask_value0.00

VACE Inpaint Keyframe Insert is how you take a few frames you drew or fixed yourself and jam them into a video timeline at exact positions, with the masks set up so Wan VACE knows the in-between frames are yours to invent. It's the node that turns "inpaint this whole clip" into "keep these five frames I spent an hour on, bridge everything else."

The workflow it fits: you've got a video sequence, you re-touch a handful of frames in an external editor, and you want VACE to regenerate the frames between them while leaving your keyframes exactly as they are. The node replaces the frames you specify with your keyframe images, keeps the total frame count unchanged, and stamps a mask value (black by default) on those keyframes - black meaning "this content is decided, don't touch it," which is the VACE convention for anchored content. The frames around them keep their white masks, so the model regenerates the gap.

How it works

You give it the video as images and a comma-separated list of 0-indexed positions:

keyframe_positions: 3,7,12

Then connect a keyframe image to keyframe_1, keyframe_2, etc., in the same order. The node parses the positions, collects the keyframes you actually connected, and requires the count to match - two positions, two keyframes, exactly. It clones the video, overwrites each position with the matching keyframe, and stamps the keyframe_mask_value (a slider, default 0.0) onto every mask at those frames. If you feed no mask sequence at all, it builds one from scratch: all white, with the keyframe positions blacked. If you do feed masks, it clones and patches those instead.

The hard limits are deliberate: each keyframe must be a single image (batch size 1), at the exact same resolution as the video, with the same channel count. That strictness is the difference between a clean inpaint and a jagged seam where a 512px keyframe met a 720p clip. Need more than five keyframes? Chain a second node - the README says so, and each pass adds its own positions.

Inputs and outputs that matter

  • images (required, IMAGE) - the video sequence you're inserting into.
  • keyframe_positions (required, STRING, default "0") - comma-separated 0-indexed frames.
  • keyframe_1keyframe_5 (IMAGE) - the frames to insert. Connect as many as you have positions.
  • keyframe_mask_value (FLOAT, 0–1 slider, default 0) - what mask value to stamp on the inserted frames. Black (0) anchors them; push it toward 1 if you want VACE to regenerate even the keyframes.
  • masks (optional, MASK) - an existing mask sequence to patch instead of generating one.

Outputs are images and masks, both the same length as the input video, ready for your VACE encode node.

Installing it

Part of the four-node rgamevfx/ComfyUI-RGnodes pack. Install through ComfyUI Manager (search "ComfyUI-RGnodes") or:

cd ComfyUI/custom_nodes
git clone https://github.com/rgamevfx/ComfyUI-RGnodes.git

Restart ComfyUI. No requirements.txt, no models to fetch - the only real dependency is the VACE pipeline it feeds into (Kijai's WanVideoWrapper or WanVaceAdvanced style graphs).

Troubleshooting

  • "Keyframe count does not match position count" - the classic. Every position in your string needs exactly one connected keyframe input, in order.
  • "Each keyframe must be a single image (batch size 1)" - you plugged in a whole sequence where it wants one frame. Extract a single frame first (LoadImage with one frame, or a video-combine-style frame grab).
  • Resolution or channel mismatch - keyframes must match the video's exact pixel dimensions and RGB/RGBA depth. Scale them first.
  • Duplicate or out-of-range positions - each position must be unique and within 0 to length−1. The error message tells you the valid range, so it's a quick fix.
CategoryVace/VFX

Inputs (9)

NameTypeDefaultDescription
imagesIMAGE
keyframe_positionsSTRING0
masksoptMASK
keyframe_1optIMAGE
keyframe_2optIMAGE
keyframe_3optIMAGE
keyframe_4optIMAGE
keyframe_5optIMAGE
keyframe_mask_valueoptFLOAT0.000–1

Outputs (2)

NameTypeDescription
imagesIMAGE
masksMASK