Add on: RTSPtoWeb and RTSPtoWebRTC

I just installed this addon as it’s what I need to display my doorbell’s camera feed on my Nvidia Shield TV using the PipUp app. My question though is do I need to install the WebRtc integration to generate the links needed fro the PipUp app or can I get a static link from the addon’s web UI?

Is it possible to enforce that the generated RTSPtoWeb config.json file includes “on_demand”: true for each channel entry?

I ask because I run HA core on a low end intel celeron based machine with 5 cameras and there is significant CPU utilization (as viewed in top) associated with the RTSPtoWeb process without on_demand.

If I manually edit the config.json file to include the on_demand parameter and restart my RTSPtoWeb service, the process is only active when viewing a camera in HA and cpu utilization is significantly lower on average. I do not observe any deleterious effects associated with having this parameter enabled in RTSPtoWeb.

Of course, manually editing the config.json file is a fragile way to achieve. Is there a better way?

Yeah, there is a similar feature request for the add-on configuration: Allow RTSPtoWeb "Stream type" configuration (On demand vs Persistent) · Issue #86 · allenporter/stream-addons · GitHub – i think the request may be for options to override per stream, but what you’re asking for is really just a default value for all new streams which seems reasonable. The work involved is to (1) make sure this is allowed as a global config in rtsptoweb (2) expose the option in the UI in the add-on and (3) have the add-on update the config json on startup.

Seems like a reasonable feature request to me.

Edit: Re-reading it seems like its the same feature request

1 Like

This question is actually about the RTSPtoWebRTC integration, not the addon. Sorry if I’m posting in the wrong place. I’m trying to use RTSPtoWebRTC integration in combination with the go2rtc addon. It works well, but whenever the RTSPtoWebRTC integration is enabled, my Amcrest cameras via the Amcrest integration stop reporting audio_detected events. If I disable the RTSPtoWebRTC integration, the audio_detected sensors via Amcrest integration work again.

Is this a bug, or expected because of how the Amcrest integration reports audio_detected events?

I’m a little confused about the configuring remote access part of this setup. Is there a preferred method for setting up a STUN server?

Or are you supposed to find one like the google example in the configuration (which appears to send data to Google)?

Appreciate the clarification here.

I just use the Google one, no idea what other people do.

You need to disable backchannel with go2rtc. Search for similar issues

Think of it as respecting human stupidity :slight_smile:

Because technologically the STUN server does not breach a person’s privacy at all. Using DNS from Google and Android phones breaches human privacy, but STUN servers do not. It’s just an unnamed packet to some server without any connection to a specific person.

People just see the word Google, and have absolutely no understanding of how the technology works from the inside:

2 Likes

@allenporter thanks for this greath add-on and integration, it reduced my 3 second latency of my reolink camera’s to vertially nothing.

However I am having some issues with accesing the camera stream when not on the local network.
I have configured the google stun server, but it still does not work.
Do I have to open port 8083 in my router for remote acces to work?
What kind of security considerations are there for opening port 8083, can anyone acces the camera streams then when they know the extermal IP and port and have some knowledge of the add-on running there?

Maybe this can be clearified under point 5 “configuring remote access” of the initial post:

Hi,
Thanks for the feedback!

So you should not need to open any ports. How it’s supposed to work is the JavaScript webrtc and the webrtc server negotiate that they will find each other’s ips via the stun servers without any port opening needed.

I am not very skilled in debugging why it may not be working but I have only really tested in chrome. You may be able to sniff some of the payloads between the browser and home assistant websocket to see if the stun servers are present in the request…

Hi allenporter,

Thanks for the quick response!
I am using the HomeAssistant android/iOS apps to vieuw the streams remotely.
I have DuckDNS with Nginx Proxy Manager to connect remotely to my HomeAssistant.
I am guessing the Proxy Manager is blocking the WebRTC stream (I think it blocks all other ports than 443).

I have a similar setup with a proxy in front of home assistant and that really isn’t supposed to matter. The point of STUN is to break out of the NAT as shown Introduction to WebRTC protocols - Web APIs | MDN

is IP required for candidate or can I use hostname.

in docker I use hostname inside docker network to connect services inside containers. trying to figure out if I can do this for connections inside docker network that do not need to leave docker network?

Where? in the integration configuration flow? Hostnames work fine.

Can you use hostnames in the go2rtc.yaml webrtc module like below?


webrtc:
  listen: ":8555"  # address of your local server (TCP)
  candidates:
    - hostname:8555 

Is everyone with Unifi equipment just configuring their cameras as Generic rtsp streams? This still doesn’t seem to work with the Unifi Integration cameras, which seem to force rtsps and causes the certificate error.

I tried to set this up with Protect in the last few days, but the streams never worked, so I removed it.

Hi, thanks for making a very useful addon.
So i’m using this with conjunction with general camera in lovelace dashboard to create a viewing station with 2 cams using a nativefier-ed HA page.
I was just wondering if there’s any way to make it auto reconnect whenever the cam loses connection,
in my case It wont auto reconnect and I have to restart or refresh the page.

The Unifi Protect camera’s do have a generic rtsp stream they just don’t show you it in the UI. You need to edit the link to this format: rtsp://x.x.x.x:7447/cXt2f3hj5MpbsjFx

What link do you mean? This works if I set up my camera as “Generic” using the method you describe, but that does not seem possible if the cameras are brought in via the Unifi Protect integration. Am I missing something?