Repeat Masks π₯π ₯π π ’
Repeat Masks
- mask
- MASK
- count
Repeat Masks (class VHS_DuplicateMasks) appends copies of a mask batch onto itself so it repeats. Multiply by 3 and the mask stack plays through three times back-to-back. It's the mask-track version of the same repeat pattern VHS provides for images and latents - same operation, different type.
If you're doing per-frame masking across a video - an animated matte, a moving inpaint region, a regional-prompt mask that changes over time - your masks are a stack, one per frame. This is how you make that stack longer by looping it.
Why you'd reach for it
Mostly to make counts line up. Video pipelines constantly demand that the mask stack match the image or latent stack frame-for-frame, and when your masks are shorter by an exact multiple, repeating them is the clean fix. The other use is holding a single mask across a run: you have one matte and a clip that wants N frames of it, so you multiply it up to N.
A common concrete case: you built a short looping mask animation and want it to cover a longer generation. Repeat it to the length you need and it tiles across the whole clip.
How it works
It concatenates the input onto itself multiply_by times along the frame axis. Output length equals input length Γ the multiplier, which the node also emits as a count. Multiply-by of 1, the default, is a pass-through.
Inputs and outputs
- mask (MASK) - the mask stack to repeat.
- multiply_by (INT, default 1, minimum 1) - how many copies total. 1 leaves it unchanged.
Outputs:
- MASK - the repeated stack.
- count (INT) - the new length (input Γ
multiply_by).
Installing it
comfy.icu already has VideoHelperSuite installed - the node's available out of the box.
Locally: ComfyUI Manager β search ComfyUI-VideoHelperSuite β install β restart. Or:
cd ComfyUI/custom_nodes
git clone https://github.com/Kosinkadink/ComfyUI-VideoHelperSuite
then restart ComfyUI.
Common issues
It repeats the whole stack, not each mask individually. A 4-mask batch Γ 3 becomes 0,1,2,3,0,1,2,3,0,1,2,3 - the sequence looped three times, not each mask tripled in place. Keep that straight or your mask timing will be off.
The real gotcha is alignment. Repeating masks changes their count, and if that count no longer matches the images or latents they're supposed to mask, you'll either hit a shape error or, worse, silently apply the wrong mask to the wrong frame for the entire clip. After repeating, confirm the mask count matches the frames it pairs with - the count output is there for exactly that check.
If the node doesn't appear in the menu, that's VideoHelperSuite failing to import (ffmpeg or a NumPy version clash). Check the startup log for the real cause and reinstall through Manager.
Inputs (2)
| Name | Type | Default | Description |
|---|---|---|---|
| mask | MASK | β | |
| multiply_by | INT | 11β9007199254740991 | β |
Outputs (2)
| Name | Type | Description |
|---|---|---|
| MASK | MASK | β |
| count | INT | β |