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
| Name | Type | Required | Default | Min / Max / Step | Description |
|---|---|---|---|---|---|
video_latent | LATENT | No | – | – | Optional video latent to which a noise mask will be added. |
audio_latent | LATENT | No | – | – | Optional audio latent to which a noise mask will be added. |
video_fps | FLOAT | Yes | 25 | 0 / 100 / 0.01 | Frame rate of the video latent, used to convert time (seconds) to frame indices. |
video_start_time | FLOAT | Yes | 0 | 0 / 10000 / 0.01 | Start time in seconds for the video mask. |
video_end_time | FLOAT | Yes | 5 | 0 / 10000 / 0.01 | End time in seconds for the video mask. |
audio_start_time | FLOAT | Yes | 0 | 0 / 10000 / 0.01 | Start time in seconds for the audio mask. |
audio_end_time | FLOAT | Yes | 5 | 0 / 10000 / 0.01 | End time in seconds for the audio mask. |
max_length | COMBO | Yes | truncate | – | How 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_mode | COMBO | No | add | – | How 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
| Type | Description |
|---|---|
LATENT | Video 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. |
LATENT | Audio 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_latentoraudio_latentmust 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_lengthsetting determines whether the output latent is resized (truncated or padded) to match the specified end time. Withpartialthe 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_modecontrols how the new mask merges with it. The defaultaddis useful for building up cumulative mask regions;overwritereplaces the mask entirely;subtractcan be used to “erase” previously masked areas. - This node is intended for use with LTXV‑based models and belongs to the
KJNodes/ltxvcategory in ComfyUI.
Comments
Sign in with GitHub to join the discussion.