Nodes/ComfyUI-LTXVideo-AVSplit/🅛🅣🅧 Set Audio Video Mask By Time Split
ComfyUI Node

🅛🅣🅧 Set Audio Video Mask By Time Split

Re-roll one bad second of an LTX-2 clip without nuking the rest

By PsypmP·Created 5 months ago·Updated 5 months ago· 0
🅛🅣🅧 Set Audio Video Mask By Time Split
  • av_latent
  • model
  • vae
  • audio_vae
  • spatial_mask
  • av_latent
video_fps24.00
video_start_time0.00
video_end_time10.00
video_slope_len3
mask_videotrue
mask_init_value_video0.00
audio_start_time0.00
audio_end_time10.00
audio_slope_len3
mask_audiotrue
mask_init_value_audio0.00
merge_existing_video_maskfalse

LTX-2 generates video and audio in one latent, and that's great until one part of the clip is bad. The hands melt at second four, the audio bridge mumbles, the camera pans when you wanted a push-in. Your instinct is to bump the seed and regenerate everything. This node is the smarter move: it stamps a time window onto the latent and says "keep this section, re-roll the rest" - separately for the video track and the audio track.

What it actually is

It's a noise-mask builder for LTX audio-video latents, a close cousin of Lightricks' official LTXVSetAudioVideoMaskByTime node but with the conditioning outputs stripped out and two behavior changes: it can merge an existing mask instead of replacing it, and a spatial mask is blended with the time envelope rather than pasted on top. If you've done image inpainting in ComfyUI, the mental model transfers: a noise_mask of 1.0 means "keep this region as-is," 0.0 means "denoise it from scratch." This node fills a 0→1→0 envelope (with smooth ramp edges) over whatever time window you pick, for video and audio independently.

How the time math works

This is the part people get wrong. Converting "seconds" to latent-frame indices is not a fixed ratio, which is why the node demands a vae and an audio_vae on top of the model. Video latent frames are spaced by the VAE's temporal stride (vae.downscale_index_formula[0] - default 8 for LTX-2), so a second at 24fps covers a different number of latent steps than a second at 30fps. Audio is worse: it derives latents-per-second from the audio VAE's sample rate, mel hop length, and downsample factor (~25 Hz for LTX-2). Get those conversions wrong and your "second 2 to 4" mask lands on the wrong frames entirely.

The node then builds the envelope, clamps it to the actual latent length (an over-long window gets cut off gracefully instead of erroring), and recombines video + audio masks into a NestedTensor noise_mask. Requires the diffusion model to be LTXAVModel and the latent to be a NestedTensor - both true if you came out of the LTX-2 AV sampler path, both hard errors otherwise.

The inputs that matter

Most of the interface is symmetrical, so you really only learn it once:

  • video_start_time / video_end_time / video_slope_len - the window and its ramp, in seconds and latent frames. slope_len is the fade width at each edge; default 3 is a decent starting point.
  • mask_video / mask_init_value_video - toggle the video mask, and set the base value outside the window (0 = fully re-roll outside, 1 = leave everything alone).
  • audio_start_time / audio_end_time / audio_slope_len / mask_audio - the same idea for the audio track. This is the underrated half: you can re-roll a bad bit of sound while keeping the picture, or vice versa.
  • spatial_mask (optional) - a (T,H,W) or (H,W) mask blended with the time envelope, so you can confine the regeneration to, say, the character instead of the whole frame.
  • merge_existing_video_mask (optional) - if the latent already carries a noise_mask, multiply your new video mask by it per-frame instead of replacing it.

The only output is av_latent, a copy of your input with the new noise_mask attached. Wire it back into your sampler's latent input.

Install

Same story as the rest of this pack. ComfyUI Manager → search ComfyUI-LTXVideo-AVSplit, or:

cd ComfyUI/custom_nodes
git clone https://github.com/PsypmP/ComfyUI-LTXVideo-AVSplit
pip install -r ComfyUI-LTXVideo-AVSplit/requirements.txt
# then restart ComfyUI

The only dependency is numpy - this is pure arithmetic on top of your existing LTX-2 install, no weights to download, no VRAM tax.

Where people get burned

The window is empty or the node is a no-op. Check the obvious first: mask_video/mask_audio flipped off, or a time window that doesn't overlap your clip's actual length. Then check you're feeding it an LTX AV model and a NestedTensor latent - this pack does nothing for plain video models. And if you also have the official ComfyUI-LTXVideo pack installed, you'll see near-identical node names in your search bar; pick the Split suffix variant, they are not the same node.

Categorylightricks/LTXV

Inputs (17)

NameTypeDefaultDescription
av_latentLATENT
modelMODEL
vaeVAE
audio_vaeVAE
video_fpsFLOAT24.000–500
video_start_timeFLOAT0.000–2000
video_end_timeFLOAT10.000–2000
video_slope_lenINT31–100
mask_videoBOOLEANtrue
mask_init_value_videoFLOAT0.000–1
audio_start_timeFLOAT0.000–2000
audio_end_timeFLOAT10.000–2000
audio_slope_lenINT31–100
mask_audioBOOLEANtrue
mask_init_value_audioFLOAT0.000–1
spatial_maskoptMASKOptional (T,H,W) or (H,W) mask; blended with temporal envelope for video (not a hard replace like LTXVSetAudioVideoMaskByTime).
merge_existing_video_maskoptBOOLEANfalseIf the latent already has noise_mask, multiply the new video mask by the existing per-frame scalar (same behavior as LTXVSetAudioVideoMaskByTime for video only).

Outputs (1)

NameTypeDescription
av_latentLATENT