Pack Video Mask
Make a per-frame mask line up with a compressed video VAE
- mask
- MASK
Video VAEs like Wan's and LTXV's don't just compress space - they compress time too. Wan's VAE squashes frames down roughly 4x temporally, which is why you'll see the "4n+1" math around Wan workflows: N pixel-space frames become far fewer latent frames, and back again on decode. If you have a mask sequence - one mask per pixel-space video frame, from a video-inpainting or masked-editing workflow - ComfyUI's default way of squeezing that down to match the latent's frame count is naive: it resizes temporally the way it'd resize spatially, which loses information or misaligns the mask against the frames it's actually supposed to cover. Pack Video Mask does that compression properly instead, per the README: it "compresses the frames of a video mask to match video VAE latent frames, to work around comfyui's naive temporal resizing of masks."
The inputs
mask(MASK) - required, your per-frame mask sequence.blend_mode(defaultmax, choicesmax/min/average) - how frames within one compression group get combined into a single latent-frame mask.maxmeans any frame in the group being masked marks the whole group masked (a union - the safe default if you don't want to under-mask).minis the opposite, an intersection - only mark it masked if every frame in the group agrees.averagegives you a soft blend rather than a hard union/intersection.causal(defaulttrue) - the node's own tooltip: "First latent frame is a single frame." Wan-style causal VAEs treat the very first output latent frame specially, since the windowing math (the 4n+1 pattern) makes it correspond to just one input frame rather than a full stride-sized group. Leave this on for Wan; turn it off if your VAE doesn't have that first-frame special case.stride(default 4) - the node's own tooltip is explicit: "downsampling factor to match VAE, ie 4 for Wan, 8 for LTXV." Set this to match whichever video model you're actually running - it's not a universal constant.
One output: MASK.
The one setting you must not leave on autopilot
stride defaults to 4, which is correct for Wan and wrong for LTXV. If you're building an LTXV masked-video workflow and leave this at the default, your mask will misalign with the latent frames it's meant to cover - the node's own tooltip already tells you the fix (8 for LTXV), so this is purely a matter of remembering to change it when you switch models, not a mystery to debug.
How to install it
ComfyUI Manager: search "ComfyUI-Image-Filters", install, restart. Manual:
cd ComfyUI/custom_nodes
git clone https://github.com/spacepxl/ComfyUI-Image-Filters
restart. Dependency is opencv-contrib-python; a cv2 import error at startup usually means another node pack pulled in a conflicting opencv variant, not this pack itself being broken - fixed on Windows via the author's install.bat/import_error_install.bat, or manually by uninstalling stray opencv installs and reinstalling opencv-contrib-python alone. No models involved, negligible compute.
Common issues & troubleshooting
Masked region seems to drift or misalign temporally with the video. Check stride first - it's the single most likely cause, and it's specific to which video model's VAE you're targeting (4 for Wan, 8 for LTXV, per the node's own tooltip). Getting this wrong is the most common way this node produces confusing results.
Masked area "leaks" into frames it shouldn't affect within a compression group. blend_mode: max unions every frame in the group - any single masked frame marks the whole group. If that's too aggressive for your use case, try min for a stricter intersection, or average for a graduated blend instead of a hard cutoff.
Unexpected behavior specifically on the first latent frame. That's what causal controls. If your VAE isn't a causal one with the single-first-frame convention Wan uses, toggle it off - leaving it on for a non-causal VAE will misapply that special case.
Inputs (4)
| Name | Type | Default | Description |
|---|---|---|---|
| mask | MASK | — | |
| blend_mode | COMBO | max | 3 options: max, min, average |
| causal | BOOLEAN | true | First latent frame is a single frame |
| stride | INT | 4 | downsampling factor to match VAE, ie 4 for Wan, 8 for LTXV |
Outputs (1)
| Name | Type | Description |
|---|---|---|
| MASK | MASK | — |