From 3e5c6be36342895e2e647e02edcecbe5c21c6e09 Mon Sep 17 00:00:00 2001 From: Marcel van der Veldt Date: Thu, 16 Jan 2025 21:30:13 +0100 Subject: [PATCH] Fix: skip soxr resampler if loudnorm is present Due to a bug in ffmpeg --- music_assistant/helpers/ffmpeg.py | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/music_assistant/helpers/ffmpeg.py b/music_assistant/helpers/ffmpeg.py index ebcd70bb..8ff24e84 100644 --- a/music_assistant/helpers/ffmpeg.py +++ b/music_assistant/helpers/ffmpeg.py @@ -311,8 +311,11 @@ def get_ffmpeg_args( # noqa: PLR0915 input_format.sample_rate != output_format.sample_rate or input_format.bit_depth > output_format.bit_depth ): - # prefer resampling with libsoxr due to its high quality - if libsoxr_support: + # prefer resampling with libsoxr due to its high quality (if its available) + # but skip libsoxr if loudnorm filter is present, due to this bug: + # https://trac.ffmpeg.org/ticket/11323 + loudnorm_present = any("loudnorm" in f for f in filter_params) + if libsoxr_support and not loudnorm_present: resample_filter = "aresample=resampler=soxr:precision=30" else: resample_filter = "aresample=resampler=swr" -- 2.34.1