Fix playback of 24 bits material
authorMarcel van der Veldt <m.vanderveldt@outlook.com>
Mon, 17 Feb 2025 19:15:20 +0000 (20:15 +0100)
committerMarcel van der Veldt <m.vanderveldt@outlook.com>
Mon, 17 Feb 2025 19:15:20 +0000 (20:15 +0100)
music_assistant/helpers/ffmpeg.py

index c4722826f279db71c6b32f1e2070775b950caa4b..525d159b2a936688d354ea295572d12877bf7ea8 100644 (file)
@@ -296,7 +296,10 @@ def get_ffmpeg_args(
             str(output_format.channels),
         ]
         if not output_format.content_type.is_pcm() and output_format.content_type.is_lossless():
-            output_args += ["-sample_fmt", f"s{output_format.bit_depth}"]
+            if output_format.bit_depth == 24:
+                output_args += ["-sample_fmt", "s32"]
+            elif output_format.bit_depth == 16:
+                output_args += ["-sample_fmt", "s16"]
         if output_format.output_format_str == "flac":
             # use level 0 compression for fastest encoding
             output_args += ["-compression_level", "0"]