add probesize to ffmpeg default args
authorMarcel van der Veldt <m.vanderveldt@outlook.com>
Sun, 5 Oct 2025 15:15:02 +0000 (17:15 +0200)
committerMarcel van der Veldt <m.vanderveldt@outlook.com>
Sun, 5 Oct 2025 15:15:02 +0000 (17:15 +0200)
music_assistant/controllers/streams.py
music_assistant/helpers/ffmpeg.py
music_assistant/providers/snapcast/player.py

index f44135154f5a554ebe1577159012f66e1d374640..db9c82a0d50e41121403f7dc23892828f5ca5b05 100644 (file)
@@ -966,8 +966,6 @@ class StreamsController(CoreController):
             # afterwards play the TTS itself.
             #
             # For this to be effective the player itself needs to be able to start playback fast.
-            # If the returned stream is used as input to ffmpeg we should pass -probesize 8096.
-            #
             # Finally, if the output_format is non-PCM, raw concatenation can be problematic.
             # So far players seem to tolerate this, but it might break some player in the future.
 
@@ -982,13 +980,11 @@ class StreamsController(CoreController):
         # work out output format/details
         fmt = announcement_url.rsplit(".")[-1]
         audio_format = AudioFormat(content_type=ContentType.try_parse(fmt))
-        extra_input_args = ["-probesize", "8096"]  # start the stream before reading all TTS input
         async for chunk in get_ffmpeg_stream(
             audio_input=announcement_url,
             input_format=audio_format,
             output_format=output_format,
             filter_params=filter_params,
-            extra_input_args=extra_input_args,
         ):
             yield chunk
 
index cfc4ffccd2e9deef5fe4468b21d09bfd781bbe8c..8d33a7851a0441680ae7a3883fae0ba84ebdceb3 100644 (file)
@@ -258,7 +258,7 @@ def get_ffmpeg_args(  # noqa: PLR0915
         "-probesize",
         "8096",
         "-analyzeduration",
-        "500000",  # 1 seconds should be enough to detect the format
+        "500000",  # 0.5 seconds should be enough to detect the format
     ]
     # collect input args
     if "-f" in extra_input_args:
index 2c40a4f5242e06b0507f96ad71c4c78c0ea73d1f..a216603c5ce03dbfc5756e8e2504bfe5068c7eda 100644 (file)
@@ -296,10 +296,6 @@ class SnapCastPlayer(Player):
 
         # stream the audio, wait for it to finish (play_announcement should return after the
         # announcement is over to avoid simultaneous announcements).
-        #
-        # Note: -probesize 8096 is needed to start playing the pre-announce before the TTS
-        #       data arrive (they arrive late, see get_announcement_stream).
-        #
         stream_path = self._get_stream_path(stream)
         self.logger.debug("Start announcement streaming to %s", stream_path)
         async with FFMpeg(
@@ -310,7 +306,7 @@ class SnapCastPlayer(Player):
                 self.mass, self.player_id, input_format, DEFAULT_SNAPCAST_FORMAT
             ),
             audio_output=stream_path,
-            extra_input_args=["-y", "-re", "-probesize", "8096"],
+            extra_input_args=["-y", "-re"],
         ) as ffmpeg_proc:
             await ffmpeg_proc.wait()