Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Configure i/o timeout duration #1118

Closed
siddhantwahal opened this issue May 17, 2024 · 4 comments
Closed

Configure i/o timeout duration #1118

siddhantwahal opened this issue May 17, 2024 · 4 comments
Assignees
Labels
enhancement New feature or request
Milestone

Comments

@siddhantwahal
Copy link

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?

@AlexxIT AlexxIT added question Further information is requested enhancement New feature or request and removed question Further information is requested labels May 17, 2024
@AlexxIT AlexxIT self-assigned this May 17, 2024
@AlexxIT
Copy link
Owner

AlexxIT commented May 17, 2024

I think this is your 15 seconds

go2rtc/pkg/rtsp/conn.go

Lines 125 to 127 in f432e72

case core.ModePassiveProducer:
// polling frames from remote RTSP Client (ex FFmpeg)
timeout = time.Second * 15

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.

@Claudio1L
Copy link

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.

@AlexxIT
Copy link
Owner

AlexxIT commented May 18, 2024

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 AlexxIT added this to the v1.9.3 milestone May 24, 2024
@AlexxIT
Copy link
Owner

AlexxIT commented Jun 6, 2024

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

@AlexxIT AlexxIT closed this as completed Jun 6, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

3 participants