go2rtc icon indicating copy to clipboard operation
go2rtc copied to clipboard

Configure i/o timeout duration

Open siddhantwahal opened this issue 1 year ago • 3 comments

We're attempting to forward an RTSP stream from an IP camera to go2rtc using FFmpeg. However, intermittent packet loss from the camera results in go2rtc disconnecting FFmpeg due to an I/O timeout. We are looking for a way to configure this timeout duration or request the addition of a configuration option.

Details:

We are using the following FFmpeg command to forward the RTSP stream:

ffmpeg -f rtsp -rtsp_transport tcp -i rtsp://CAMERA_RTSP_URL:PORT/PATH -c copy -f rtsp -rtsp_transport tcp rtsp://GO2RTC_URL:8554/PATH

(We're using the incoming sources feature of go2rtc.)

Issue:

Occasionally, packets from the camera fail to arrive, causing no packets to be forwarded to go2rtc. When this occurs, go2rtc disconnects FFmpeg with the following error message:

handle error="read tcp 172.27.0.2:8554->10.xxx.xxx.xxx:60991: i/o timeout"

Based on empirical measurements, this timeout duration is approximately 15 seconds.

Request:

  1. Is there a way to configure the timeout duration in go2rtc?
  2. If not, would you be open to adding a configuration option to adjust this timeout?

siddhantwahal avatar May 17 '24 09:05 siddhantwahal

I think this is your 15 seconds https://github.com/AlexxIT/go2rtc/blob/f432e72dd0f1f3be1dc8ae437b99d146180284ec/pkg/rtsp/conn.go#L125-L127

I'll think about settings this value. Maybe via query param.

PS. 15 sec is a quite large value. The client defaults to 5 sec.

AlexxIT avatar May 17 '24 09:05 AlexxIT

I suffer the same issue with go2rtc/Frigate under Proxmox. Have a camera with not so solid wifi connection and can't modify the network to mitigate the issue. Every one or two days have to reboot frigate to regain visibility.

Claudio1L avatar May 17 '24 12:05 Claudio1L

This issue only about incoming RTSP. But RTSP source has timeout setting via #timeout param. In any case, it is no good if the camera has not sent a single packet within 5 seconds (default).

AlexxIT avatar May 18 '24 13:05 AlexxIT

Added new query parameter for RTSP server: rtsp://localhost:8554/camera1?timeout=123 https://github.com/AlexxIT/go2rtc/releases/tag/v1.9.3

AlexxIT avatar Jun 06 '24 13:06 AlexxIT

I suffer the same issue with go2rtc/Frigate under Proxmox. Have a camera with not so solid wifi connection and can't modify the network to mitigate the issue. Every one or two days have to reboot frigate to regain visibility.

did you fixed your issue using timeout param ?

aarnaud avatar Feb 24 '25 16:02 aarnaud