From 37d4469077ef1d1a97a3eb2b55238112fabcea15 Mon Sep 17 00:00:00 2001 From: Marcel van der Veldt Date: Thu, 11 Apr 2024 15:45:41 +0200 Subject: [PATCH] fix ffmpeg for output channels --- music_assistant/server/helpers/audio.py | 17 +++++------------ 1 file changed, 5 insertions(+), 12 deletions(-) diff --git a/music_assistant/server/helpers/audio.py b/music_assistant/server/helpers/audio.py index 3e742d66..0b7f7e6b 100644 --- a/music_assistant/server/helpers/audio.py +++ b/music_assistant/server/helpers/audio.py @@ -950,19 +950,8 @@ def get_ffmpeg_args( # collect output args if output_path.upper() == "NULL": + # devnull stream output_args = ["-f", "null", "-"] - elif output_format.content_type.is_pcm(): - output_args = [ - "-acodec", - output_format.content_type.name.lower(), - "-f", - output_format.content_type.value, - "-ac", - str(output_format.channels), - "-ar", - str(output_format.sample_rate), - output_path, - ] elif output_format.content_type == ContentType.UNKNOWN: # use wav so we at least have some headers for the rest of the chain output_args = ["-f", "wav", output_path] @@ -973,8 +962,12 @@ def get_ffmpeg_args( output_format.content_type.value, "-ar", str(output_format.sample_rate), + "-ac", + str(output_format.channels), output_path, ] + if output_format.content_type.is_pcm(): + output_args += ["-acodec", output_format.content_type.name.lower()] # determine if we need to do resampling if ( -- 2.34.1