mirror of
https://github.com/vladmandic/automatic
synced 2026-09-01 10:01:01 +02:00
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:
@@ -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,
|
||||
|
||||
@@ -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
|
||||
|
||||
Reference in New Issue
Block a user