Skip to content

AV latent support for LTXVLoopingSampler and LTXVExtendSampler#472

Open
Jean J. de Jong (jjdejong) wants to merge 5 commits intoLightricks:masterfrom
jjdejong:av-looping-sampler
Open

AV latent support for LTXVLoopingSampler and LTXVExtendSampler#472
Jean J. de Jong (jjdejong) wants to merge 5 commits intoLightricks:masterfrom
jjdejong:av-looping-sampler

Conversation

@jjdejong
Copy link
Copy Markdown

Summary

  • Add audio-visual latent support to LTXVLoopingSampler and LTXVExtendSampler (and the LTXVBaseSampler / LTXVInContextSampler building blocks), removing the ValueError guard that previously rejected AV latents.
  • Audio is carried jointly with video through the temporal tiling loop — separated on input, sliced/extended per tile alongside the video overlap geometry, accumulated across tiles, and reassembled into an AV NestedTensor on output.
  • For stage-2 refinement (low-sigma upscale), the input audio data initializes each tile's audio frames instead of zeros, so lipsync and AV coherence are refined jointly with video — matching the behavior of the single-pass SamplerCustomAdvanced workflow.
  • Adds example workflows + docs for two-pass I2V looping (single-tile and 30s 3-tile variants with MultiPromptProvider) and a V2V detailer doc.

Implementation notes

  • New helpers _make_av_latent_dict() / _split_av_latent_dict() in easy_samplers.py handle NestedTensor packing/unpacking with proper noise-mask propagation for both modalities.
  • Audio temporal compression differs from video; frame_overlap (expressed in video latent frames) is converted via the audio VAE stride before audio slicing.
  • Backward compatible: with no audio component in the input latent, both samplers behave exactly as before.

Motivation

Previously, the looping and extend samplers raised ValueError: LoopingSampler currently does not support Audio Visual latents., forcing users to generate audio in a separate low-sigma pass on top of a video-only result. That workaround produces inferior lipsync because audio is never refined jointly with video across temporal tiles. This change makes joint AV generation possible in long-form clips.

Testing status

  • LTXVLoopingSampler AV path — confirmed working end-to-end. Audio is generated jointly with video and stays synchronised across tile boundaries; verified with the included two-pass workflow.
  • ⚠️ LTXVExtendSampler AV path — implemented but not fully validated. The extend pass runs without errors when handed a source AV latent, but joint AV continuity across the extend boundary has not been rigorously compared against the workaround pipeline.
  • ⚠️ optional_negative_index_strength — wired through all samplers but not extensively tested. The default (1.0) preserves prior behavior; intermediate values to soften reference-image influence have not been validated on a reference set.

Test plan

  • Run LTX-2.3_Two_Pass_I2V_Looping.json with an AV latent and confirm decoded audio is in sync with video.
  • Run LTX-2.3_Two_Pass_I2V_Looping_30s.json (3 tiles) and confirm audio continuity across both tile boundaries.
  • Run a video-extension workflow with a source AV latent through LTXVExtendSampler and confirm audio continuation is coherent across the overlap region.
  • Sweep optional_negative_index_strength across {0.0, 0.5, 1.0} on a reference-conditioned generation to confirm monotonic influence reduction.
  • Confirm video-only inputs still produce identical output (no regression for the non-AV path).

🤖 Generated with Claude Code

…ampler

The looping and extend samplers currently reject AV latents with a
ValueError, forcing users to generate audio in a separate low-sigma
pass. This produces inferior results because audio is not refined
jointly with video across temporal tiles.

This change removes the AV rejection guard and carries audio latents
through the temporal tiling loop alongside video:

- LTXVLoopingSampler: separates AV input into video + audio, passes
  audio slices to each tile's sampler, accumulates audio output across
  tiles, and reassembles the AV NestedTensor on output.

- LTXVExtendSampler: accepts audio tile data, computes audio overlap
  and new-frame geometry matching the video tile structure, creates
  proper audio noise masks, and wraps/unwraps AV latents around all
  SamplerCustomAdvanced calls.

- LTXVBaseSampler / LTXVInContextSampler: accept optional audio tile,
  wrap into AV latent before sampling, split on output.

For stage-2 refinement (low-sigma upscale pass), the input audio data
is used to initialize each tile's audio frames instead of zeros,
enabling the model to refine lipsync and audio-visual coherence at
higher resolution — matching the behavior of the standard two-stage
workflow using SamplerCustomAdvanced directly.

Helper functions _make_av_latent_dict() and _split_av_latent_dict()
handle the NestedTensor packing/unpacking with proper noise mask
propagation for both modalities.

Co-Authored-By: Claude Opus 4.6 <[email protected]>
- Two-pass I2V looping workflow (single-tile and 30s 3-tile variants)
  with reference image conditioning at tile boundaries
- 30s variant adds MultiPromptProvider for per-tile prompt variation
  and RepeatImageBatch for guiding images at transitions
- V2V Detailer doc with Strix Halo OOM prevention and arbitrary-length
  video handling notes
- Python generator script for the two-pass workflow

Co-Authored-By: Claude Opus 4.6 <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant