Increase ffmpeg timeout to 10 seconds (#17831)

FFmpeg adds an extra delay for the first start of the stream. For some cameras the stream start can be 1 second, for some cameras it can be more than 5 seconds. Frigate by default used a timeout of 5 seconds and drops the connection without waiting for a response from go2rtc. Originally suggested by @AlexxIT in https://github.com/AlexxIT/go2rtc/issues/1633
This commit is contained in:
Josh Hawkins 2025-04-21 07:38:51 -05:00 committed by GitHub
parent 6e79ec1624
commit 592141daaa
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
2 changed files with 8 additions and 8 deletions

View File

@ -102,7 +102,7 @@ elif go2rtc_config["ffmpeg"].get("bin") is None:
# need to replace ffmpeg command when using ffmpeg4 # need to replace ffmpeg command when using ffmpeg4
if LIBAVFORMAT_VERSION_MAJOR < 59: if LIBAVFORMAT_VERSION_MAJOR < 59:
rtsp_args = "-fflags nobuffer -flags low_delay -stimeout 5000000 -user_agent go2rtc/ffmpeg -rtsp_transport tcp -i {input}" rtsp_args = "-fflags nobuffer -flags low_delay -stimeout 10000000 -user_agent go2rtc/ffmpeg -rtsp_transport tcp -i {input}"
if go2rtc_config.get("ffmpeg") is None: if go2rtc_config.get("ffmpeg") is None:
go2rtc_config["ffmpeg"] = {"rtsp": rtsp_args} go2rtc_config["ffmpeg"] = {"rtsp": rtsp_args}
elif go2rtc_config["ffmpeg"].get("rtsp") is None: elif go2rtc_config["ffmpeg"].get("rtsp") is None:

View File

@ -283,7 +283,7 @@ PRESETS_INPUT = {
"-probesize", "-probesize",
"1000M", "1000M",
"-rw_timeout", "-rw_timeout",
"5000000", "10000000",
], ],
"preset-rtmp-generic": [ "preset-rtmp-generic": [
"-avoid_negative_ts", "-avoid_negative_ts",
@ -297,7 +297,7 @@ PRESETS_INPUT = {
"-fflags", "-fflags",
"+genpts+discardcorrupt", "+genpts+discardcorrupt",
"-rw_timeout", "-rw_timeout",
"5000000", "10000000",
"-use_wallclock_as_timestamps", "-use_wallclock_as_timestamps",
"1", "1",
"-f", "-f",
@ -312,7 +312,7 @@ PRESETS_INPUT = {
"-rtsp_transport", "-rtsp_transport",
"tcp", "tcp",
TIMEOUT_PARAM, TIMEOUT_PARAM,
"5000000", "10000000",
"-use_wallclock_as_timestamps", "-use_wallclock_as_timestamps",
"1", "1",
], ],
@ -321,14 +321,14 @@ PRESETS_INPUT = {
"-rtsp_transport", "-rtsp_transport",
"tcp", "tcp",
TIMEOUT_PARAM, TIMEOUT_PARAM,
"5000000", "10000000",
], ],
"preset-rtsp-restream-low-latency": _user_agent_args "preset-rtsp-restream-low-latency": _user_agent_args
+ [ + [
"-rtsp_transport", "-rtsp_transport",
"tcp", "tcp",
TIMEOUT_PARAM, TIMEOUT_PARAM,
"5000000", "10000000",
"-fflags", "-fflags",
"nobuffer", "nobuffer",
"-flags", "-flags",
@ -343,7 +343,7 @@ PRESETS_INPUT = {
"-rtsp_transport", "-rtsp_transport",
"udp", "udp",
TIMEOUT_PARAM, TIMEOUT_PARAM,
"5000000", "10000000",
"-use_wallclock_as_timestamps", "-use_wallclock_as_timestamps",
"1", "1",
], ],
@ -362,7 +362,7 @@ PRESETS_INPUT = {
"-rtsp_transport", "-rtsp_transport",
"tcp", "tcp",
TIMEOUT_PARAM, TIMEOUT_PARAM,
"5000000", "10000000",
"-use_wallclock_as_timestamps", "-use_wallclock_as_timestamps",
"1", "1",
], ],