Nodes/KJNodes for ComfyUI/LTXVAudioVideoMask
ComfyUI Node Runs on cloud

LTXVAudioVideoMask

Regenerate a time slice of an LTX-2 audio+video clip

By kijai·Created 3 years ago·Updated 2 days ago· 3,030
LTXVAudioVideoMask
  • video_latent
  • audio_latent
  • video_latent
  • audio_latent
video_fps25.00
video_start_time0.00
video_end_time5.00
audio_start_time0.00
audio_end_time5.00
max_lengthtruncate
existing_mask_modeadd

LTX-2 is the model that generates video and audio together, and this node is how you tell it "keep most of the clip, but regenerate this stretch." It builds noise masks over the time ranges you specify - separately for the video latent and the audio latent - and the model only generates new content inside the masked regions. Everything outside the mask is left as-is. It's temporal inpainting for an audio-video clip.

That "video and audio separately" part is the useful bit. Because LTX-2 treats the two as distinct latents, you can mask a different time range for each: regenerate seconds 2–4 of the audio while leaving the picture alone, or vice versa. That's a level of control you don't get if you think of the clip as one indivisible thing.

Why you'd reach for it

Two common needs. First, fixing a bad patch: a clip is mostly great but there's a glitchy half-second - mask that range and re-roll just it, instead of regenerating the whole (expensive) clip and hoping the good parts survive. Second, extending or altering timing: mask the tail of the video to generate a continuation, or mask a segment of audio to swap what's said/heard while keeping lip and motion sync intact.

LTX has a fast-moving ecosystem - Kijai is reliably first to ship ComfyUI support and helper nodes when Lightricks drops a new version, and nodes like this are how the community actually drives the model's inpainting and editing modes.

The inputs and outputs that matter

The time ranges are the heart of it, expressed in seconds:

  • video_fps (FLOAT, default 25) - the clip's frame rate, so the node can translate seconds into the right latent frames. Match this to your generation's fps.
  • video_start_time / video_end_time (FLOAT, default 0 / 5) - the seconds of video to regenerate.
  • audio_start_time / audio_end_time (FLOAT, default 0 / 5) - the seconds of audio to regenerate, set independently of the video range.
  • max_length (default truncate) - how to handle length when the ranges don't line up.

The latents you're masking come in as optional inputs - video_latent (LATENT) and audio_latent (LATENT) - and existing_mask_mode (default add) controls how a new mask combines with a mask that's already on the latent (so you can build up multiple masked regions).

Outputs are video_latent and audio_latent (both LATENT), now carrying their noise masks - feed them into your LTX-2 sampler, which will regenerate only inside the masked time windows.

How to install it

ComfyUI Manager: search KJNodes for ComfyUI, install, restart. Manually:

cd ComfyUI/custom_nodes
git clone https://github.com/kijai/ComfyUI-KJNodes
pip install -r ComfyUI-KJNodes/requirements.txt

Restart and it's under KJNodes/ltxv. The node itself pulls no models, but you'll need a working LTX-2 setup (the model, its VAE, the LTX sampler nodes) for the latents this expects to exist.

Common issues & troubleshooting

The masked region doesn't line up with what I see. The seconds-to-frames math depends on video_fps. If it doesn't match the fps your clip was generated at, your 2–4s mask lands somewhere else. Set video_fps to the real rate first.

Audio and video drift apart after regenerating. You masked them over different ranges. That's a feature when you want it, a bug when you don't - if you're regenerating a moment and want sync preserved, mask the same time window for both video and audio.

Nothing changed. No latents connected, or a zero-width range (start == end). Both video_latent and audio_latent are optional inputs, so if you forget to wire the one you meant to mask, the node has nothing to act on. Confirm the range is non-empty too.

Building up multiple regions overwrites the last one. That's what existing_mask_mode is for - leave it on add to accumulate masks across several passes rather than replacing.

CategoryKJNodes/ltxv

Inputs (9)

NameTypeDefaultDescription
video_fpsFLOAT25.000–100
video_start_timeFLOAT0.000–10000Start time in seconds for the video mask.
video_end_timeFLOAT5.000–10000End time in seconds for the video mask.
audio_start_timeFLOAT0.000–10000Start time in seconds for the audio mask.
audio_end_timeFLOAT5.000–10000End time in seconds for the audio mask.
max_lengthCOMBOtruncate'truncate': cut latent to end_time length. 'pad': extend latent to end_time. 'partial': mask range within existing latent.
video_latentoptLATENT
audio_latentoptLATENT
existing_mask_modeoptCOMBOaddHow to combine with existing noise masks if present. 'add' will take the max of existing and new mask, 'overwrite' will replace with new mask. 'subtract' will set the masked region to 0 instead of 1, effectively unmasking it.

Outputs (2)

NameTypeDescription
video_latentLATENT
audio_latentLATENT