UR Keyframe Prep
Hand your inpaint model a frame it can actually eat
- images
- mask
- original_frame
- prepared_frame
- prepared_mask
- filled_frame
- prepared_width
- prepared_height
- frame_count
Inpaint models are fussy eaters. Some want the masked area pre-painted with a solid color, most want dimensions that are multiples of their training resolution, and every single one wants to see the mask aligned perfectly with the frame it's looking at. UR Keyframe Prep is the node that does that pre-digestion: it pulls one keyframe out of your batch, aligns the mask to it, resizes, pads, and produces a filled_frame - the frame with the masked region painted over - that you can feed straight into any keyframe repair or edit model.
This is the "give the model a clean plate to work from" step, and it's what makes the remove pipeline feel like it was designed rather than stitched together.
How it works
Feed it the frame batch and the mask batch. It grabs the frame at frame_index and the matching mask slice, then runs the prep chain:
- Resize (optional) - if
resize_longest_sideis set above 0, the frame (and mask, and filled frame) is scaled so its longest side hits that value. Leave it at 0 to keep native resolution. - Pad - pads width and height up to the next multiple of
pad_to_multiple, which defaults to 16. That's the safe floor for latent-friendly dimensions; if your inpaint model prefers a specific multiple (some want 32 or 64), set it. - Fill - replaces every masked pixel with
fill_color. The default is a solid green, and this is deliberate: a loudly-colored placeholder tells the model "this region is what needs replacing," in the same spirit as the classic inpainting trick of pre-painting the mask area.
The outputs
Seven of them, but four do the work:
- prepared_frame - the keyframe, resized and padded, mask aligned.
- prepared_mask - the mask in the same prepared geometry. This pair is what your inpaint pipeline conditions on.
- filled_frame - the one the README explicitly says can go straight into any keyframe repair/inpaint/edit model. This is your "model input."
- frame_count - a friendly way to know how many frames are in your batch (it's just the batch size, but handy as a constant).
original_frame, prepared_width, and prepared_height round out the set - the original untouched keyframe for reference, and the post-prep dimensions so you know what resolution you actually generated.
The standard wire: mask producer → UR Mask Processor → UR Keyframe Prep → your inpaint model → UR Soft Composite. If you're running a video propagation model afterward (the README suggests one as optional), the filled frame is also the clean base it wants.
Common issues
The number one mistake is leaving resize_longest_side at 0 and then wondering why the model chokes on an awkward dimension - if you know your model's preferred size, set it explicitly. Second, fill_color matters more than it looks: the default green works, but if your target object is green, a different placeholder avoids confusing the model. Third, remember this node only prepares the keyframe - the mask alignment happens inside it, so if the mask batch and image batch don't match frame-for-frame, the node auto-matches them, but the frame you inpaint is the one you named. Point frame_index at the right keyframe or everything downstream repairs the wrong moment.
Inputs (6)
| Name | Type | Default | Description |
|---|---|---|---|
| images | IMAGE | — | |
| mask | MASK | — | |
| frame_index | INT | 00–1000000 | — |
| fill_color | STRING | #00FF00 | — |
| resize_longest_side | INT | 00–8192 | — |
| pad_to_multiple | INT | 161–256 | — |
Outputs (7)
| Name | Type | Description |
|---|---|---|
| original_frame | IMAGE | — |
| prepared_frame | IMAGE | — |
| prepared_mask | MASK | — |
| filled_frame | IMAGE | — |
| prepared_width | INT | — |
| prepared_height | INT | — |
| frame_count | INT | — |