Nodes/comfyui-mixlab-nodes/MaskList Replace ♾️Mixlab
ComfyUI Node Runs on cloud

MaskList Replace ♾️Mixlab

MaskList Replace — Swapping a Range of Frames in a Mask Sequence

By MixLabPro·Created 3 years ago·Updated 2 months ago· 1,859
MaskList Replace ♾️Mixlab
  • masks
  • mask_replace
  • MASK
start_index0
end_index0
invertfalse

Look at where this node actually lives: not Mixlab/Mask, where you'd expect a mask-manipulation node, but Mixlab/Video. That placement is the whole clue to what it's for. This isn't about editing one mask - it's about editing a range inside a sequence of masks, the kind of per-frame mask stack you get when you're masking a video clip frame by frame.

The mechanics map directly onto that use case. You bring in masks, a list of masks - your full per-frame mask sequence - and mask_replace, a single mask you want dropped in over part of that sequence. start_index and end_index (both integers, both defaulting to 0) mark the range of frames to swap out. invert is a boolean, default false, that flips the selection: instead of replacing frames inside the start/end range, it replaces everything outside it. The output is a MASK list - the full sequence again, but with your replacement mask swapped in wherever the index range (or its inverse) pointed.

The practical case this covers: you've got a mask track running across a video where most frames are fine, but a handful of frames - say, where a subject briefly turns or an occlusion throws off automatic segmentation - need a manually corrected mask instead. Rather than rebuilding the whole sequence, MaskList Replace lets you patch just that window with one static replacement mask, indices start_index through end_index, and leave every other frame in the sequence untouched.

One thing to watch when you set this up: both index defaults are 0, which means an unconfigured node replaces a single frame at position 0 rather than doing nothing - it's not a no-op by default the way some optional-looking nodes are. If you drop this into a workflow and forget to set end_index, don't be surprised if only frame zero of your sequence changes and the rest looks untouched; that's the node working exactly as configured, not a bug. Also worth being deliberate about invert - it's easy to misread "replace outside the range" and "replace inside the range" as the same operation when you're eyeballing results quickly, and getting it backwards means you've replaced the 95% of frames you meant to keep and left the 5% you meant to fix.

Install follows the pack's standard path. Through ComfyUI Manager: search "comfyui-mixlab-nodes," install, restart. Manually:

cd ComfyUI/custom_nodes
git clone https://github.com/shadowcz007/comfyui-mixlab-nodes.git
cd comfyui-mixlab-nodes
install.bat

or pip3 install -r requirements.txt in a venv, or the embedded-python pip call for a portable build. Restart ComfyUI once it finishes. No model download involved - this is index arithmetic over a mask list, not an inference step - so if the node's missing from the search after install, that's a pack-level load problem worth checking the console for, not something particular to this node.

Category♾️Mixlab/Video

Inputs (5)

NameTypeDefaultDescription
masksMASK
mask_replaceMASK
start_indexINT0
end_indexINT0
invertBOOLEANfalse

Outputs (1)

NameTypeDescription
MASKMASK