From: Marcel van der Veldt Date: Thu, 16 Jan 2025 20:30:13 +0000 (+0100) Subject: Fix: skip soxr resampler if loudnorm is present X-Git-Url: https://git.kitaultman.com/?a=commitdiff_plain;h=3e5c6be36342895e2e647e02edcecbe5c21c6e09;p=music-assistant-server.git Fix: skip soxr resampler if loudnorm is present Due to a bug in ffmpeg --- 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"