ComfyUI Node

Latent Strip Mask

The one-line node that unblocks LTX2 latent concatenation

By ckinpdx·Created 5 months ago·Updated 5 months ago· 2
Latent Strip Mask
  • latent
  • LATENT

Latent Strip Mask is the kind of node that makes you laugh when you see the source: one input, one output, and a single line of logic that pops a key off a Python dict. And yet it exists because a real workflow was crashing without it. Sometimes the most useful node in the pack is the one that just deletes the thing that's breaking everything else.

The crash it exists to fix

In ComfyUI, a "latent" isn't just a tensor - it's a dict. There's the samples tensor, and optionally a noise_mask that tells the sampler which regions to regenerate. That mask is great for inpainting. It's a menace when it lingers where it doesn't belong.

The LTX-2 native node LTXVAddLatents merges two latents together, and it tries to merge their noise_masks too. When you're building long-form LTX2 audio+video (AV) workflows with sliding windows, a trimmed audio latent often still carries a mask from an earlier generation pass. The merge logic then does its math on masks of mismatched shapes and dies with a dimension error. The author's fix: strip the mask before concatenation. That's the node.

What it actually does

Feed it a latent (LATENT), get a LATENT back. In between, the code makes a shallow copy and drops the noise_mask key if it exists:

s = latent.copy()
s.pop("noise_mask", None)
return (s,)

That's the entire mechanism. It doesn't touch the samples, doesn't reshape anything, doesn't care about 4D versus 5D - it just guarantees the output has no mask attached. Because it works on the copy, the original latent is untouched, so you can run it inline without worrying about downstream side effects.

When you'd reach for it

Two situations, really:

  • LTX2 sliding-window audio accumulation. Any time a latent that's been through a previous sampling pass is about to go into LTXVAddLatents (or any node with mask-merge logic), run it through here first. This is the pairing the pack is built around: trim your audio latent with LTXAudioLatentTrim, strip the mask, then concat.
  • Any latent carrying a stale mask you don't want. If a mask from an inpainting or generation pass is affecting a node's behavior in ways you didn't intend, this is a surgical way to drop it. It's also a handy debugging tool - if a concat or add node is failing and you suspect mask shenanigans, strip and retry.

It is not a resampling or masking-creation node. It only removes. If you need to build a mask, you're in the wrong place.

Installing it

This is the sibling node in the ComfyUI-LTXAudioLatentTrim pack, so the install is shared:

cd ComfyUI/custom_nodes
git clone https://github.com/ckinpdx/ComfyUI-LTXAudioLatentTrim

Restart ComfyUI, or use ComfyUI Manager and search "ComfyUI-LTXAudioLatentTrim". You'll find the node under latent.

No model files, no dependencies, no requirements.txt - the whole pack is pure Python. There is genuinely nothing to go wrong at install time.

Common issues

  • It's not showing up. Restart ComfyUI after the clone. That's the fix for 99% of "where is my node" posts, and it applies here too.
  • The crash didn't go away. If LTXVAddLatents still errors after stripping, the problem isn't the mask - check the latent shapes you're feeding it (audio is 4D [B, C, T, F], video is 5D [B, C, T, H, W], and you can't just jam them together).
  • "Doesn't this already exist?" Roughly, yes - you can hack the same effect by editing a latent's dict, but a node you can drop into a workflow without writing Python is worth having.

If you're not doing LTX2 AV or long-form video at all, skip this one. But the first time LTXVAddLatents throws a mask shape error in the middle of a long generation, you'll be glad it's sitting there in your node list.

Categorylatent

Inputs (1)

NameTypeDefaultDescription
latentLATENT

Outputs (1)

NameTypeDescription
LATENTLATENT