tsightler / ring-mqtt

Ring devices to MQTT Bridge
MIT License
574 stars 103 forks source link

Can’t get livestream to work #499

Closed freekeys closed 1 year ago

freekeys commented 1 year ago

Describe the Bug

I get a timed out message when trying to set up the generic camera component

Steps to Reproduce

Activate add-on, copy RTSP link, install generic camera integration

Expected Behavior

Hoping to see stream

Log Output

2022-11-13T16:57:44.073Z ring-rtsp INF [RTSP] [conn 172.30.32.1:47210] opened
2022-11-13T16:57:44.076Z ring-rtsp INF [path 083a880abf67_live] runOnDemand command started
2022-11-13T16:57:44.085Z ring-rtsp [Front Door] Sending command to activate live stream ON-DEMAND
2022-11-13T16:57:44.099Z ring-mqtt [Front Door] Received set live stream state ON-DEMAND
2022-11-13T16:57:48.772Z ring-mqtt [Front Door] Successfully retrieved updated snapshot
2022-11-13T16:57:48.772Z ring-mqtt

Screenshots

No response

Config File

N/A

Install Type

Home Assistant Addon

Version

v5.0.5

Operating System

Home Assistant OS

Architecture

x86/64

Machine Details

Intel NUC

freekeys commented 1 year ago

Sorry, log output got truncated. See fuller logs below:

2022-11-13T17:37:22.519Z ring-rtsp INF [RTSP] [conn 172.30.32.1:60806] opened 2022-11-13T17:37:22.522Z ring-rtsp INF [path 083a880abf67_live] runOnDemand command started 2022-11-13T17:37:22.532Z ring-rtsp [Front Door] Sending command to activate live stream ON-DEMAND 2022-11-13T17:37:22.554Z ring-mqtt [Front Door] Received set live stream state ON-DEMAND 2022-11-13T17:37:32.524Z ring-rtsp INF [path 083a880abf67_live] runOnDemand command stopped 2022-11-13T17:37:32.524Z ring-rtsp INF [RTSP] [conn 172.30.32.1:60806] closed (source of path '083a880abf67_live' has timed out) 2022-11-13T17:37:32.525Z ring-rtsp [Front Door] Deactivating live stream due to signal from RTSP server (no more active clients or publisher ended stream) 2022-11-13T17:37:32.535Z ring-mqtt [Front Door] Received set live stream state OFF 2022-11-13T17:37:32.536Z ring-mqtt [Front Door] Stopping live stream session on workerId 1

tsightler commented 1 year ago

Please restart the addon as the logs above show that a stream was not even attempted to be started, which means the addon thinks a stream is already active. Also note that restarting HA via the UI does not restart the addon, which seems to be a common point of confusion for many users, you must explicitly restart the addon or reboot the system.

tsightler commented 1 year ago

Any feedback? After restarting the addon please test the stream again and provide logs from the first attempt.

freekeys commented 1 year ago

Thanks so much, this resolved it! I appreciate the support.

On Tue, 15 Nov 2022 at 01:42, tsightler @.***> wrote:

Any feedback? After restarting the addon please test the stream again and provide logs from the first attempt.

— Reply to this email directly, view it on GitHub https://github.com/tsightler/ring-mqtt/issues/499#issuecomment-1314641358, or unsubscribe https://github.com/notifications/unsubscribe-auth/AAMJL5KRASYVYWVONNYRJFDWILTBLANCNFSM6AAAAAAR7D3CEQ . You are receiving this because you authored the thread.Message ID: @.***>

tsightler commented 1 year ago

Good to know. Still indicates that there's a corner case where the session state can get out of sync, so I need to figure that out, but I think I know where this is.

freekeys commented 1 year ago

Great! It’s working a treat now. I can mute my chime when my baby is sleeping (I used to use a smart plug on the chime) and have the Ring stream to my TV chromecast there’s someone at the door.. amazing! Thanks 😊 I’ve noticed there’s about a 15 second lag when casting - I presume that part cloud / part my hardware?

On Tue, 15 Nov 2022 at 14:14, tsightler @.***> wrote:

Good to know. Still indicates that there's a corner case where the session state can get out of sync, so I need to figure that out, but I think I know where this is.

— Reply to this email directly, view it on GitHub https://github.com/tsightler/ring-mqtt/issues/499#issuecomment-1315369406, or unsubscribe https://github.com/notifications/unsubscribe-auth/AAMJL5JGOHXQZSZMCMXWX6DWIOLFPANCNFSM6AAAAAAR7D3CEQ . You are receiving this because you authored the thread.Message ID: @.***>

tsightler commented 1 year ago

I'm not sure why the lag would be so high honestly. Ring-mqtt itself typically has <1 second of total latency, for example, I use to go2rtc addon so that I can get a native WebRTC camera view in HA easily and, if I watch my front porch camera in both the HA UI and the Ring native web app at the same time, the Ring app beats it by probably 2/10ths of a second, which I think is pretty good seeing that the Ring app is streaming natively from Ring servers to my web browser, while the HA has to go from Ring servers -> Javascript based WebRTC -> ffmpeg -> rtsp-simple-server -> go2rtc addon -> web browser WebRTC. And this is all just running on a RPi4b, so nothing special hardware wise.

When not using go2rtc, viewing the video in HA will add another 3-5 seconds because it uses HLS, but I would think that would be the worst. However, I have no idea how you are actually streaming to the Chromecast. I've heard that the best way to get low latency to the Chromecast is to transcode to MJPEG, but I've never done any of that stuff because I don't have that much use for it.

AlexxIT commented 1 year ago

Low latency streaming to Chromecast implemented here https://github.com/AlexxIT/WebRTC#cast-or-share-stream

Also you can use this https://stestagg.github.io/dashcast/ or https://github.com/AlexxIT/DashCast and stream webpage with WebRTC code. Example webpage from go2rtc.

Also you can use PIP https://github.com/AlexxIT/WebRTC/issues/34 Some app versions support WebRTC, some MJPEG.

freekeys commented 1 year ago

Ah amazing thank you so much. I’ll check these out and let you know how I get on.

On Wed, 16 Nov 2022 at 09:10, Alex X @.***> wrote:

Low latency streaming to Chromecast implemented here https://github.com/AlexxIT/WebRTC#cast-or-share-stream

Also you can use this https://stestagg.github.io/dashcast/ or https://github.com/AlexxIT/DashCast and stream webpage with WebRTC code. Example webpage from go2rtc.

Also you can use PIP AlexxIT/WebRTC#34 https://github.com/AlexxIT/WebRTC/issues/34 Some app versions support WebRTC, some MJPEG.

— Reply to this email directly, view it on GitHub https://github.com/tsightler/ring-mqtt/issues/499#issuecomment-1316647031, or unsubscribe https://github.com/notifications/unsubscribe-auth/AAMJL5NJNO73CMSBMRYN6NDWISQHPANCNFSM6AAAAAAR7D3CEQ . You are receiving this because you authored the thread.Message ID: @.***>