fix(video): take the audio rate from the loaded vocoder

Pipelines rarely report a sample rate, so the save path fell back to 24000.
LTX-2.3 and 2.5 run at 48k, and muxing at half the rate drops the track an
octave. The rate now comes from the vocoder, as the LTX tab already did.
This commit is contained in:
CalamitousFelicitousness
2026-08-12 02:03:06 +01:00
parent 780495ff2e
commit f01e752b06
2 changed files with 11 additions and 1 deletions
+1 -1
View File
@@ -326,7 +326,7 @@ def run(selected: models_def.Model, *,
p=p,
pixels=pixels,
audio=waveform,
aac_sample_rate=getattr(p, 'audio_sampling_rate', None) or 24000,
aac_sample_rate=video_save.get_audio_rate(p),
binary=processed.bytes,
mp4_fps=save_fps,
mp4_codec=mp4_codec,
+10
View File
@@ -11,6 +11,16 @@ from modules.logger import log
from modules.video_models.video_utils import check_av
def get_audio_rate(p=None, default: int = 24000) -> int:
# pipeline output wins when it reports a rate, else the loaded vocoder: LTX-2.0 runs at 24k,
# 2.3 and 2.5 at 48k, and muxing at the wrong rate shifts the pitch
rate = getattr(p, 'audio_sampling_rate', None) if p is not None else None
if not rate:
vocoder = getattr(shared.sd_model, 'vocoder', None)
rate = getattr(getattr(vocoder, 'config', None), 'output_sampling_rate', None)
return int(rate) if rate else default
def get_video_filename(p:processing.StableDiffusionProcessingVideo):
from modules.image.namegen import FilenameGenerator
from modules.paths import resolve_output_path