# 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.
# 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
"-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:
# 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(
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()