From: Marcel van der Veldt Date: Sun, 5 Oct 2025 15:15:02 +0000 (+0200) Subject: add probesize to ffmpeg default args X-Git-Url: https://git.kitaultman.com/?a=commitdiff_plain;h=0095f4dad9b2851434aa60c1573417053b7de00a;p=music-assistant-server.git add probesize to ffmpeg default args --- diff --git a/music_assistant/controllers/streams.py b/music_assistant/controllers/streams.py index f4413515..db9c82a0 100644 --- a/music_assistant/controllers/streams.py +++ b/music_assistant/controllers/streams.py @@ -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 diff --git a/music_assistant/helpers/ffmpeg.py b/music_assistant/helpers/ffmpeg.py index cfc4ffcc..8d33a785 100644 --- a/music_assistant/helpers/ffmpeg.py +++ b/music_assistant/helpers/ffmpeg.py @@ -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: diff --git a/music_assistant/providers/snapcast/player.py b/music_assistant/providers/snapcast/player.py index 2c40a4f5..a216603c 100644 --- a/music_assistant/providers/snapcast/player.py +++ b/music_assistant/providers/snapcast/player.py @@ -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()