Merge Masks π₯π ₯π π ’
Merge Masks
- mask_A
- mask_B
- MASK
- count
Merge Masks joins two groups of masks into one, A followed by B. If you've split a mask sequence apart, processed the halves separately, and now want them back as a single track - or you just have two mask stacks you want to concatenate in order - this is the node that stitches them together.
It's the reassembly half of the split/merge pair. Split Masks carves a stack in two; Merge Masks puts two stacks back into one, in the order you wire them.
Why you'd reach for it
Concatenating mask sequences comes up whenever you build a clip in pieces: mask the first section one way, the second another, then merge into a continuous track for the full render. It's also how you assemble a mask timeline from separate sources - an intro matte plus a main-section matte, joined end to end.
The wrinkle that makes this node more than a plain concat: the two mask groups might not be the same resolution. Merge Masks handles that mismatch for you rather than erroring, which is why it carries a few extra settings.
How it works
The output is simply group A's masks followed by group B's. When A and B have different resolutions, the node has to pick a target size and rescale the odd one out - that's what the widgets control.
- merge_strategy decides which resolution wins:
match Aalways uses A's size,match Buses B's,match smallerpicks the smaller by area,match largerpicks the larger. - scale_method is the interpolation used when rescaling -
nearest-exact,bilinear,area,bicubic, orbislerp. For masks,nearest-exactkeeps edges hard; the smoother methods soften them. - crop chooses how to handle an aspect-ratio difference:
disabledstretches to fit,centercrops to preserve aspect ratio.
Inputs and outputs
- mask_A (MASK) - the first group; appears first in the output.
- mask_B (MASK) - the second group; appended after A.
- merge_strategy, scale_method, crop - the resolution-handling settings above.
Outputs:
- MASK - the combined stack, A then B.
- count (INT) - the total length of the merged group.
If both inputs are already the same size, the strategy and scaling settings never come into play - it's a straight concatenation.
Installing it
comfy.icu has VideoHelperSuite pre-installed, so nothing to do.
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
Order matters and isn't symmetric: A comes first, B second. Swap the wires and your merged timeline plays in the wrong order. There's no reordering after the fact beyond re-wiring, so get A and B right.
If your merged masks look stretched or unexpectedly cropped, the culprit is a resolution mismatch plus your crop/merge_strategy choice. Stretched means crop: disabled forced an aspect change; a chopped matte means crop: center cropped to fit. Decide which you actually want. And for crisp mask edges, prefer nearest-exact as the scale method - bilinear/bicubic will feather the boundary, which is rarely what you want in a mask.
If the node's missing entirely, that's the pack failing to import (ffmpeg or a NumPy clash); check the startup log and reinstall through Manager.
Inputs (5)
| Name | Type | Default | Description |
|---|---|---|---|
| mask_A | MASK | β | |
| mask_B | MASK | β | |
| merge_strategy | COMBO | 4 options: match A, match B, match smaller, match larger | |
| scale_method | COMBO | 5 options: nearest-exact, bilinear, area, bicubic, bislerp | |
| crop | COMBO | 2 options: disabled, center |
Outputs (2)
| Name | Type | Description |
|---|---|---|
| MASK | MASK | β |
| count | INT | β |