KJNodes/ltxvgenerated

LTXV Audio Video Mask(LTXVAudioVideoMask)

Creates noise masks for video and audio latents based on specified time ranges. New content is generated within these masked regions

LTXV Audio Video Mask

video_latent
audio_latent
video_latent
audio_latent
video_fps
25.00
video_start_time
0.00
video_end_time
5.00
audio_start_time
0.00
audio_end_time
5.00
max_length
truncate
existing_mask_mode
add
KJNodes

Description

Creates noise masks for video and audio latents based on specified time ranges. The generated masks indicate which temporal regions should be regenerated during sampling – new content is produced within the masked areas while unchanged regions are preserved. This is useful for making local edits to a video‑latent or audio‑latent sequence, such as replacing a specific segment while keeping the rest intact.

Inputs

NameTypeRequiredDefaultMin / Max / StepDescription
video_latentLATENTNoOptional video latent to which a noise mask will be added.
audio_latentLATENTNoOptional audio latent to which a noise mask will be added.
video_fpsFLOATYes250 / 100 / 0.01Frame rate of the video latent, used to convert time (seconds) to frame indices.
video_start_timeFLOATYes00 / 10000 / 0.01Start time in seconds for the video mask.
video_end_timeFLOATYes50 / 10000 / 0.01End time in seconds for the video mask.
audio_start_timeFLOATYes00 / 10000 / 0.01Start time in seconds for the audio mask.
audio_end_timeFLOATYes50 / 10000 / 0.01End time in seconds for the audio mask.
max_lengthCOMBOYestruncateHow to handle the total length of the output latent(s):
truncate – cut the latent to exactly end_time length
pad – extend the latent to end_time if it is shorter
partial – create a mask for the time range within the existing latent without changing its total length
existing_mask_modeCOMBONoaddHow to combine with any existing noise mask already present in the input latent(s):
add – take the maximum of the existing and new mask (union)
overwrite – replace the existing mask entirely with the new one
subtract – set the masked region to 0 instead of 1, effectively unmasking that area

Outputs

TypeDescription
LATENTVideo latent with an updated noise mask (or newly created mask) applied. If no video_latent was provided, a latent batch containing only the mask (no samples) is returned.
LATENTAudio latent with an updated noise mask (or newly created mask) applied. If no audio_latent was provided, a latent batch containing only the mask is returned.

Both outputs are standard ComfyUI latent dictionaries that include a noise_mask key. The mask is a binary tensor where 1 indicates areas to be regenerated and 0 indicates areas to be preserved.

Usage Notes

  • At least one of video_latent or audio_latent must be connected. If only one is provided, only that corresponding output will contain meaningful sample data; the other output will be a mask‑only latent.
  • Time values are in seconds and are converted to frame indices using the provided video_fps. This conversion assumes that the temporal dimension of the latent corresponds to (number_of_frames) at the given fps. For audio latents, the same fps value is used to align the mask with the audio latent’s temporal structure.
  • The max_length setting determines whether the output latent is resized (truncated or padded) to match the specified end time. With partial the latent retains its original length, and the mask only covers the requested range.
  • When an input latent already contains a noise_mask (e.g., from a prior node), existing_mask_mode controls how the new mask merges with it. The default add is useful for building up cumulative mask regions; overwrite replaces the mask entirely; subtract can be used to “erase” previously masked areas.
  • This node is intended for use with LTXV‑based models and belongs to the KJNodes/ltxv category in ComfyUI.

Comments

Sign in with GitHub to join the discussion.

Loading comments…
LTXV Audio Video Mask (LTXVAudioVideoMask) - ComfyUI-KJNodes | ComfyUI Wiki