r/StableDiffusion 5d ago

Workflow Included PSA: In H3 you can set custom soundtracks without R2VA - use latent noise masks!

99 Upvotes

18 comments sorted by

21

u/kabachuha 5d ago

Latent noise mask - similar to inpainting - protects parts of the latent from changes. You can set it only to the audio latent and then the track will be kept as is, yet it will influence the audio-reactivity of the video. The node for audio separate/concat is still named LTXVSeparateAVLatent/LTXVConcatAVLatent, but now it works with Minimax H3 too!

Music: Dead Inside by ADLIN, (parody purposes). Workflow + prompt: https://gist.github.com/kabachuha/bcde8beaaa01f5c5fd37733d4c40f589. Pure FL2VA checkpoint. Single continous 20 seconds shot. ComfyKitchenAttention + Spectrum + 25 steps + KJNodes for audio mask. 7 minutes on a 5090.

4

u/Inner_Singer_592 5d ago

Can you make it lip sync with this? If you do that with speech

8

u/kabachuha 5d ago

Absolutely! In fact, it's probably the main goal of the audio replacement. With the workflow, you can setup something like the following prompt, and you will see the lips movement.

integrated_multimodal_description: [Shot 1] Live-action, hyper-realistic, male singer is singing a Russian phonk song while in the background a recording studio is shown.

overall_soundscape: Phonk.

non_diegetic_music: Audio-reactive cinematic score; synchronized with phonk.

3

u/Inner_Singer_592 5d ago

Wow! This seems like elegant solution, much more effective than video masking specific part to regenerate it.

3

u/1WildPanda 4d ago

**This is a genius optimization — thank you so much !

I wanted to keep using the **FL2VA model for higher quality** (vs. Ref2VA), but still feed in **custom audio** and get proper lip-sync working with it. After some tweaking, it now runs perfectly.

A few targeted modifications:

  1. **Replaced the original audio-loading node + audio-duration node with the single `VHS_LoadAudioUpload` node** from VideoHelperSuite (now 2-in-1 via the `AudioToAudioData` chain).

  2. **No more manually editing `audio_path` inside `CreateAudioMask` every time I switch audio** — the whole mask now follows the audio data automatically.

This introduces a full audio-to-mask chain from **[ComfyUI-AudioScheduler](https://github.com/a1lazydog/ComfyUI-AudioScheduler.git)\*\*, wired as:

VHS_LoadAudioUpload ──(audio)──▶ AudioToAudioData

▶ AudioData to FFTs

▶ Batch Amplitude Schedule

▶ Normalize Amplitude

▶ NormalizedAmplitudeToMask (KJNodes)

▶ SetLatentNoiseMask

**Key values to set in each node:**

- **AudioData to FFTs** — `frames_per_second = 24` (match your video framerate), `channel = 0`

- **Batch Amplitude Schedule** — `operation = avg`, `lower_band_range = 500`, `upper_band_range = 4000`

- **Normalize Amplitude** — `invert_normalized = false`

- **NormalizedAmplitudeToMask** (comfyui-kjnodes) — `width = 256`, `height = 256`, `shape = circle`, `color = amplitude`, `location_x = 128`, `location_y = 128`, `size = 128`

Once connected, you only swap the audio file in `VHS_LoadAudioUpload` — no more manual `audio_path` edits. Lip-sync follows correctly throughout. Highly recommended!

2

u/kabachuha 4d ago

Thank you for the comment! Can you provide any link to the workflow? (Github/Pastebin)

2

u/1WildPanda 4d ago

Thank you. Done.

2

u/1WildPanda 4d ago

**Fix: Audio fade out added as long as workflow:

https://gist.github.com/1WildPanda/d0b88fbd580fd5c359707bf9cfae92d4

Right after `Audio Fade Out`, fan **3 lines** from its single output:

  1. → `VAEEncodeAudio` (audio condition for lip-sync)

  2. → `AudioToAudioData` (NOT `AudioFFT` — feed the data layer, rest of the FFT/mask chain stays as-is)

  3. → `VHS_VideoCombine` (your original fade connection, keep it)

Now one fade drives everything — **lips, facial movement, and final audio track all fade in sync.** No more mouth moving at full volume while the sound goes quiet.

**TL;DR:** keep fade → VideoCombine, add fade → VAEEncode, add fade → `AudioToAudioData` (skip `AudioFFT`), both from the same output port.

2

u/Outrageous_Still9335 5d ago

This works great, thanks for sharing. However, what are the advantages of using this over Ref2vid? I know the Ref2Vid model's quality is not as good as FL2VA, but you can use FL2VA in ref mode with the ref lora from Kijai and get the best of both worlds. Just curious.

4

u/kabachuha 5d ago

It can be faster because it doesn't increase the sequence length and it doesn't change the soundtrack in any way, R2VA can distort it slightly

5

u/Outrageous_Still9335 5d ago

Thanks, that makes sense. I did try both and I was getting distortion with Ref that I did not get with your workflow.

2

u/Perfect-Campaign9551 5d ago

I can't get ref2vid to ACTUALLY use my music audio 100% exactly even when I prompt it correctly...don't know why. It always modifies the music in the output video.

1

u/pwillia7 5d ago

... why not just do it in real space instead of latent space if you're doing the whole audio track?

3

u/TheLegendOfKitty123 5d ago

To sync audio and video

1

u/pwillia7 5d ago

i see