go2rtc icon indicating copy to clipboard operation
go2rtc copied to clipboard

There is no retry mechanism for timeouts

Open fast8888 opened this issue 2 years ago • 5 comments

There is no retry mechanism for timeouts

I'm through FRP camera port public network, such as RTSP: / / 192.168.4.190:554 / ch01, the port 554 through the public network, and then to public server, link through the server, run for a few hours, if the network fluctuations, or FRP penetration is not stable, lead to broken links, Go2rtc, there is no way to re-link, can only restart GO2RTC

err log

[36murl=[0m"ffmpeg:rtsp://127.0.0.1:54189/ch0#channel=1#subtype=0#audio=opus#unicast=true#resolution=1280x720#video=vp9#raw=-vf transpose=2" [90m09:25:04.397[0m [1m[31mERR[0m[0m [exec] timeout [36murl=[0m"exec:ffmpeg -hide_banner -allowed_media_types video+audio -fflags nobuffer -flags low_delay -rtsp_transport tcp -i rtsp://127.0.0.1:54189/ch0 -vf transpose=2 -codec:a libopus -ar 48000 -ac 2 -rtsp_transport tcp -f rtsp rtsp://localhost:8554/d40d0930ba209bfe3ee7a339de5253e4"

fast8888 avatar Sep 12 '22 09:09 fast8888

I'm seeing similar behavior. I have a FOSCAM camera that loves to occasionally drop off of wifi then immediately reconnect. I am restarting the go2rtc add-on several times a day in response which... isn't ideal.

Great tool though, outside of this one issue I love the add-on!

aderusha avatar Sep 13 '22 11:09 aderusha

Same behavior here as well, however these are wired cameras. Never had an issue before using RTSPtoWeb, but switched to go2rtc and occasionally random cameras will drop requiring a restart of go2rtc

mattbrad2 avatar Sep 16 '22 15:09 mattbrad2

Really great project here, works great with ring-mqtt project and gives fast camera startup and low latency. I'd like to start recommending this to ring-mqtt users as the preferred setup, but the retry issue is a little bit of a blocker as these cameras timeout a live view after 10 minutes and, after that, the only recourse is to restart go2rtc.

Would be really nice if the retry timeout was configurable vs hard coded.

Thanks again for all of your hard work on this!

tsightler avatar Oct 01 '22 19:10 tsightler

I was able to capture the logs for when the stream stops working for me:

image

Restarting go2rtc fixes the issue.

felipecrs avatar Oct 16 '22 16:10 felipecrs

I proposed a short-term solution at:

  • https://github.com/AlexxIT/go2rtc/pull/88

felipecrs avatar Oct 23 '22 21:10 felipecrs

Having same issue, especially on dashboards that load up 6+ cameras at once. Previously fine using other WebRTC solutions but they are too high cpu usage.

spacebares avatar Nov 01 '22 07:11 spacebares

Should be fixed in https://github.com/AlexxIT/go2rtc/releases/tag/v0.1-rc.1

go2rtc will try to instant reconnect to source. And will continue to try each 30 sec.

AlexxIT avatar Nov 04 '22 20:11 AlexxIT

I still get timeouts and they don't seem to attempt a reconnection...

calisro avatar Nov 05 '22 21:11 calisro

This works perfectly for me now. All streams have been up for several days now where before it would only be a few hours.

mattbrad2 avatar Nov 07 '22 17:11 mattbrad2

I noticed that this is still an issue on the latest release 0.1-rc.5. One of my cameras sometimes has issues with wifi and the stream is not stable. go2rtc seems to restart but without loading the config yaml file (which contains the name and rtsp url for all my cameras). So no streams are available on go2rtc.

Here are some logs that I see after noticing that no streams are available anymore:

20:45:01.019 WRN github.com/AlexxIT/go2rtc/cmd/streams/producer.go:105 > error="read tcp xxx.xxx.xxx.xxx:33232->xxx.xxx.xxx.xxx:14554: i/o timeout"
00:51:32.739 WRN github.com/AlexxIT/go2rtc/cmd/streams/producer.go:105 > error="read tcp xxx.xxx.xxx.xxx:37842->xxx.xxx.xxx.xxx:14554: i/o timeout"
08:28:10.702 WRN github.com/AlexxIT/go2rtc/cmd/streams/producer.go:105 > error="RTSP wrong input"
09:30:20.630 WRN github.com/AlexxIT/go2rtc/cmd/streams/producer.go:105 > error="read tcp xxx.xxx.xxx.xxx:51142->xxx.xxx.xxx.xxx:14554: i/o timeout"
09:34:20.660 WRN github.com/AlexxIT/go2rtc/cmd/streams/producer.go:105 > error="read tcp xxx.xxx.xxx.xxx:51678->xxx.xxx.xxx.xxx:14554: i/o timeout"
09:38:26.864 WRN github.com/AlexxIT/go2rtc/cmd/streams/producer.go:105 > error="read tcp xxx.xxx.xxx.xxx:52168->xxx.xxx.xxx.xxx:14554: i/o timeout"
22:46:10.078 WRN github.com/AlexxIT/go2rtc/cmd/streams/producer.go:105 > error="read tcp xxx.xxx.xxx.xxx:35568->xxx.xxx.xxx.xxx:14554: i/o timeout"
03:38:33.987 WRN github.com/AlexxIT/go2rtc/cmd/streams/producer.go:105 > error="read tcp xxx.xxx.xxx.xxx:40084->xxx.xxx.xxx.xxx:14554: i/o timeout"
12:19:45.509 WRN github.com/AlexxIT/go2rtc/cmd/streams/producer.go:105 > error="read tcp xxx.xxx.xxx.xxx:48548->xxx.xxx.xxx.xxx:14554: i/o timeout"
14:25:32.044 WRN github.com/AlexxIT/go2rtc/cmd/streams/producer.go:105 > error="read tcp xxx.xxx.xxx.xxx:37896->xxx.xxx.xxx.xxx:17554: i/o timeout"
2022/12/16 22:20:17 [INFO] mdns: Closing client {true false 0xc00000e848 <nil> 0xc00000e850 <nil> 1 0xc00003c7e0}

otherippo avatar Dec 17 '22 15:12 otherippo

Don't understand what you mean about "without loading the config yaml file". The restart mechanism works, as shown by your logs.

AlexxIT avatar Dec 17 '22 19:12 AlexxIT

The config file go2rtc.yaml is mounted into the docker container. In the streams section all my cameras are listed by name and rtsp url. When I (re-)start the container go2rtc loads this config file and I can access all streams.

Now if an error occurs (like in the logs above) go2rtc restarts but doesn't load this config file. It behaves as if there was no config file, aka no cameras have been defined. So I can't access any stream until I manually restart the container.

otherippo avatar Dec 17 '22 20:12 otherippo

@otherippo you're probably experiencing https://github.com/AlexxIT/go2rtc/issues/116

NickM-27 avatar Dec 17 '22 20:12 NickM-27

@NickM-27 yes it is exactly the same problem

otherippo avatar Dec 17 '22 20:12 otherippo