Go2rtc project - help thread

That’s not true… You’re going to need to fwd the port or move the port to a cloudflare proxy one (that may or may not work well).

I use cloudflare.

Aha, so it works for you and have you made any special settings to cloudflare, or just open forwarding 8555 on your firewall?

The only thing i’ve done is forward 8555 and allowed connections to that port outside of cloudflare. All other ports are denied outside of cloudflare. I had considered changing the port to a cloudflare proxied port but haven’t tried it.

1 Like

How do you change the port for go2rtc then? Did not find that info…maybe I’m blind

  1. You need to forward WebRTC port even when using cloudflare.
  2. You can see stream outside LAN in go2rtc Web UI on “normal” devices because it can stream via WebRTC and MSE technology. So when WebRTC doesn’t work - MSE will work.
  3. You can’t see stream on your iPhone because it is only device in the world that doesn’t support MSE technology. So when WebRTC doesn’t work - you can’t see anything.

Latest go2rtc stream viewer has support yet another technology, special for iPhones. So some picture should be in go2rtc Web UI.

yes is running as addon, yes i can see the stream of each camera, all is working.
I dont get why i need to add them as generic camera, problably i dont understand this point

The source of your camera now is go2rtc server, so the generic camera must point to the rtsp stream of go2rtc.

and what is the point of using rtsptowebrtc if i’m getting the rstp stream of go2rtc and using it directly in the generic camera? i’m sorry but i’m not understanding.

Probably i’m getting confused by this part


View almost any Hass camera using `WebRTC` technology, supported codecs `H264`/`PCMU`/`PCMA`/`OPUS`, best latency.

When the stream starts - the camera `entity_id` will be added to go2rtc "on the fly". You don't need to add cameras manually to [go2rtc config](https://github.com/AlexxIT/go2rtc#configuration). Some cameras (like [Nest](https://www.home-assistant.io/integrations/nest/)) have a dynamic link to the stream, it will be updated each time a stream is started from the Hass interface.

1. Hass > Settings > Integrations > Add Integration > [RTSPtoWebRTC](https://my.home-assistant.io/redirect/config_flow_start/?domain=rtsp_to_webrtc) > `http://127.0.0.1:1984/`
2. Use Picture Entity or Picture Glance lovelace card

You can add camera `entity_id` to [go2rtc config](https://github.com/AlexxIT/go2rtc#configuration) if you need transcoding:

streams: "camera.hall": ffmpeg:{input}#video=copy#audio=opus

PS. Default Home Assistant lovelace cards don't support 2-way audio. You can use 2-way audio from [Add-on Web UI](https://my.home-assistant.io/redirect/supervisor_addon/?addon=a889bffc_go2rtc&repository_url=https%3A%2F%2Fgithub.com%2FAlexxIT%2Fhassio-addons). But you need use HTTPS to access the microphone. This is a browser restriction and cannot be avoided.

it seemed to me that this way i could generate some fast camera entities, so that i could integrate them into the homeassistant lovelace. Can someone please explain to me what paragraph means instead?
i need to add the rstp stream of go2rtc in the picture entity directly? i’m so confused…

You are mixing things.

When you add a camera config manually to go2rtc.yaml file, it shows up on the webpage of go2rtc and only lives there. If you want to use this as a camera entity inside HA you need to create a generic camera pointing to this. You then can add it to your dashboard (isn’t called lovelace anymore ;-)). Or if you want them added as a iframe you don’t even need to add them to HA you can just point the iframe to the stream URL from go2rtc.

When you already have camera entities configured inside HA and you connect the rtsptowebrtc integration it tries to redirect the existing camera entities through go2rtc. You don’t need to edit the go2rtc.yaml file for this. When you have already added these existing entities to show in your dashboard and you navigate to the go2rtc webpage these should be added automatically.

Generic camera (from real camera or from go2rtc) will not save you from latency of viewing. Because it used popular but not best technology for live streaming - HLS.

When you setup RTSPtoWebRTC integration - this streaming technology automatically changes from HLS to WebRTC. Thats how HA works.

  1. You need to forward WebRTC port even when using cloudflare. (it make no difference if I port forwarding or not, same functionality)
  2. You can see stream outside LAN in go2rtc Web UI on “normal” devices because it can stream via WebRTC and MSE technology. So when WebRTC doesn’t work - MSE will work. (I can see the stream on my iPhone, but in point 3 you say it should not work)
  3. You can’t see stream on your iPhone because it is only device in the world that doesn’t support MSE technology. So when WebRTC doesn’t work - you can’t see anything. (But I can see something in the go2rct web UI so something is working but not in lovelace)

Latest go2rtc stream viewer has support yet another technology, special for iPhones. So some picture should be in go2rtc Web UI.

I made a small video where I show what is happing Video.mov - VEED (video is just valid for 24h)

As you see first I’m on wifi, then I turn of wifi and use 5G then the streaming stopps working in lovelace but then I go to the go2rtc web UI and choose the same camera and can get is streaming fine. So this is why I ask if I could get that stream in Lovelace somehow?

The short answer is no, you can’t.

Lovelace has a very simple sync version of webrtc without client public candidates.

go2rtc WebUI implement four streaming technologies simultaneously:

  1. async webrtc with public client candidates
  2. mse (for modern browsers)
  3. mp4 over websocket (for iPhones)
  4. mjpeg (if you have this codec in stream)

It will use all of them simultaniosly.

  1. webrtc didn’t work for you because you haven’t setup tunnel properly
  2. mse didn’t work for you because you using iPhone
  3. mjpeg didn’t work for you because you haven’t setup transcoding for this stream

only mp4 over websocket works for you (but it is worst technology for streaming)

1 Like

Thanks then it’s clearer but it seams like there is a way to get it working on an iPhone, right? Could you maybe help in the right direction what I need to configure to get it working?

I have port forwarded 8555 now and also I tried to add this:

webrtc:
    listen: "**REDACTED**:8555" #Local IP of ny HA
ngrok:
    command: ngrok tcp 8555 --authtoken **REDACTED** #token

If you using cloudflare TCP tunnel (TCP is important), you need to add cloudflare candidate with port to go2rtc YAML config. Check issues on GitHub. Some users already do it.

For ngrok you don’t need to add candidates because go2rtc can get them from ngrok app

2 Likes

Hello

I Have a Dahua IPC-K22P. It supports Onvif profile T. I want to use it as video doorbell with 2 way audio.
I am facing 2 problems , First is how to add a push to talk button on the lovelace card. Second is I am not able to get live stream working on my mobile app. It works file with my desktop browser with external access but from mobile app live stream is not working. I have configured the NGNIX accordingly. If I use direct link

https://mydomain/api/hassio_ingress/z4gtBvEc00SO1aPNY30H0pwksNo9x-Mu8R4gsk8VSLU/webrtc.html?src=doorbell_cam

and

https://mydomain/go2rtc/webrtc.html?src=doorbell_cam

both links works fine but when I add these in iframe it does not work as it supposed to. I do not get live feed , Also do I need to add the camera to frigate to get that 2 way audio working ?

Nginx can’t proxy WebRTC traffic. This is the whole point of WebRTC. It doesn’t use HTTP to transmit real-time data.

The options for public access to WebRTC are described in the documentation.

Thanks Alexx, Got it working with ngrok. Now from companion app I can get 2 way audio working from webui externally. Next step I have to figure out how to make a lovelace card where I can have it with 2 way audio.

If you scroll up you’ll see examples using iframe and also frigate card (which is what I use without the frigate backend)

what should be the url for iframe? , I am sorry but I am little new to the lovelace cards

Who uses RTSPtoWebRTC integration. It is important to add STUN server in the integration settings. This will improve external access to your cameras via WebRTC technology:

RTSPtoWebRTC > Configure > STUN server: stun.l.google.com:19302

2 Likes