Frames Masks Uninterpolate
Shrink a per-frame mask to Wan's latent frame rate
- raw_temporal_mask
- temporal_mask
This is a small, specific fix for a real Wan-video headache. You have a temporal mask - one mask frame per video frame, saying "condition here on frames 10–30" - but Wan doesn't sample in video frames, it samples in latent frames, and there are far fewer of them. Frames Masks Uninterpolate collapses your full-resolution temporal mask down to the latent frame rate so it lines up with what the sampler actually sees.
The reason this node needs to exist is Wan's VAE. It compresses time by roughly 4x: a stack of N video frames becomes about ((N - 1) // 4) + 1 latent frames. So a 60-frame mask isn't a 60-slot mask to the model - it's more like 16. If you feed a per-video-frame mask straight into temporal conditioning, the frame indices don't match and your mask lands in the wrong place. "Uninterpolate" is the honest name for what it does: it undoes the frame interpolation, downsampling the mask in the time dimension so one mask slot maps to one latent slot. It's a companion to RES4LYF's temporal (frame-by-frame) conditioning for Wan.
How it works
It walks your mask along the time axis and reduces every frame_chunk_size video frames into a single latent-frame mask, producing a shorter MASK stack aligned to the compressed latent timeline.
The inputs and outputs that matter
This node is refreshingly small - two inputs, one output:
raw_temporal_mask(MASK) - your full per-video-frame mask stack, at the video's frame count.frame_chunk_size(default 4) - how many video frames collapse into one latent frame. Default 4 matches Wan's ~4x temporal compression, which is what you want in almost every case.temporal_mask(MASK) out - the downsampled mask, ready to feed into a temporal conditioning node.
How to install it
ComfyUI Manager: search RES4LYF, install, restart. Manual:
cd ComfyUI/custom_nodes
git clone https://github.com/ClownsharkBatwing/RES4LYF
cd RES4LYF
pip install -r requirements.txt
then restart and hard-refresh (F5). No downloads.
Common issues & troubleshooting
The mask is off by a frame or two. Wan's frame math isn't a clean divide - the "+1" in ((N - 1) // 4) + 1 means valid clip lengths are 4n+1 (1, 5, 9, 13, …). If your source frame count isn't one of those, the last latent frame can be partial and the mask can end a frame short. Match your clip length to a 4n+1 value.
You changed frame_chunk_size and the timing drifted. Unless you're on a model with a different temporal compression ratio, leave it at 4 - it's tuned to Wan's VAE. Setting it to something else makes the mask disagree with the latent timeline, which is the exact problem this node exists to prevent.
The mask has no visible effect. This node only prepares a mask; it doesn't apply anything. Its output has to reach a temporal conditioning node that actually uses it, or nothing happens downstream.
Inputs (2)
| Name | Type | Default | Description |
|---|---|---|---|
| raw_temporal_mask | MASK | — | |
| frame_chunk_size | INT | 41–10000 | — |
Outputs (1)
| Name | Type | Description |
|---|---|---|
| temporal_mask | MASK | — |