Select Masks π₯π ₯π π ’
Select Masks
- mask
- MASK
Select Masks pulls specific masks out of a stack by index. You type which ones you want - 0, 4, 9, or a range like 0:12 - and it returns exactly those, in the order you asked. It's the mask-track counterpart to Select Latents: same index language, applied to masks instead of latents.
When you're doing per-frame masking across a clip, the mask stack is addressable like a list, and this is the node that lets you address it - filter it down, reorder it, reverse it, grab the last one.
The index syntax
The indexes field is a comma-separated string that understands single indices, negatives, and Python-style ranges with steps. Assuming 16 masks (indices 0β15):
0β mask[0]-1β the last mask,[15]0, 1, 13β those three, in order0:5, 13β 0,1,2,3,4, then 13 (ranges exclude the end index)0:-1β everything but the last0:5:-1β[4, 3, 2, 1, 0](a negative step reverses the range)0:5:2β[0, 2, 4](step of 2)::-1β the whole stack, reversed
Because the output follows the order you type, this reorders as easily as it filters. That ::-1 reverse is the quick way to play a mask sequence backwards.
Inputs and outputs
- mask (MASK) - the stack to select from.
- indexes (STRING, default
0) - the selection expression. - err_if_missing (BOOLEAN, default true) - throw an error if you reference an index that doesn't exist, instead of silently dropping it. Keep it on while building.
- err_if_empty (BOOLEAN, default true) - throw if the selection resolves to nothing.
Output is a single MASK stack of exactly your selection.
Installing it
comfy.icu already ships VideoHelperSuite, so the node's there by default.
Locally: ComfyUI Manager β search ComfyUI-VideoHelperSuite β install β restart. Or:
cd ComfyUI/custom_nodes
git clone https://github.com/Kosinkadink/ComfyUI-VideoHelperSuite
then restart ComfyUI. Kosinkadink's suite, standard for video and per-frame ControlNet setups.
Common issues
Ranges exclude their end index - 0:8 returns eight masks (0 through 7), not nine. That off-by-one is the most common mistake, and it's especially painful when you're trying to line a mask selection up with a matching frame selection. Select the same way on both tracks or they'll drift by one.
Leave err_if_missing on unless you have a specific reason not to. A silently shortened mask stack that no longer matches your images is the kind of bug that produces subtly-wrong results with no error to point at - the loud failure is the merciful one. Turn it off only when you're deliberately over-selecting from a variable-length stack and want the misses ignored.
If the node's absent from the menu, that's VideoHelperSuite failing to import (ffmpeg or a NumPy version clash). The startup log has the cause; reinstall through Manager.
Inputs (4)
| Name | Type | Default | Description |
|---|---|---|---|
| mask | MASK | β | |
| indexes | STRING | 0 | β |
| err_if_missing | BOOLEAN | true | β |
| err_if_empty | BOOLEAN | true | β |
Outputs (1)
| Name | Type | Description |
|---|---|---|
| MASK | MASK | β |