Add on: RTSPtoWeb and RTSPtoWebRTC

This addon was conflicting with ports for another of my addons so I uninstalled it but the ports are still active and listening. Does anyone know how to stop it listening?

bash-5.1# netstat -tanp|grep go2rtc
tcp6       0      0 :::8554                 :::*                    LISTEN      111/go2rtc-1.1.1    
tcp6       0      0 :::8555                 :::*                    LISTEN      111/go2rtc-1.1.1    
tcp6       0      0 :::1984                 :::*                    LISTEN      111/go2rtc-1.1.1

Unsure what you mean ā€˜genericā€™ camara, I might be misunderstanding your question. For me to get RTSPtoWeb to work with Unifi Protect cameras I did the following:

Went to the confirg screen of RTSPtoWeb, clicked on ā€˜Add Streamā€™ and enter the URL of my Unifi rtsps stream but change the URL to the example I gave above: rtsp ://x.x.x.x:7447 /cXt2f3hj5MpbsjFx

This is discussed in RTSPtoWeb - WebRTC port in use even after restart Ā· Issue #61 Ā· allenporter/stream-addons Ā· GitHub ā€“ donā€™t have a solution yet.

That is unfortunate. Looks like the issue has been open a while too. I canā€™t use my other addon which streams one of my cameras anymore unless there is some workaround :slightly_frowning_face:

I am using RTSPtoWebRTP because RTSPtoWeb does not have audio support. Is there a way to configure streams?

The only workaround is to keep changing the port.

I noticed that the cameras in the mobile application do not always show the video right away. Often the stream is only released after about 30 seconds. This behavior was confirmed by several people. Anything known about this?

Im using the RTSPtoWeb standalone Docker, not add-on. Hope its ok to post here as this seems to be where all the RTSPtoWeb discussion is.

I can setup the integration fine and it discovers the RTSPtoWeb server, but when I open a camera stream I get error Error handling WebRTC offer: RTSPtoWeb server returned malformed payload: None

I have a slightly more advanced network setup and possibly have something misconfigured. Cameras are on a seperate VLAN, but Home Assistant and RTSPtoWeb are on same VLAN. Im not able to run RTSPtoWeb in host mode, but have TCP ports 8083 and 5541 mapped, along with UDP 30000-40000. RTSPtoWeb is configured to use that port range.

If I set up a camera in RTSPtoWeb, all works and I can stream via Web UI.

I have debug logging enabled for homeassistant.components.rtsp_to_webrtc, homeassistant.components.camera, and rtsp_to_webrtc. All I see in the log is:

2023-03-26 11:57:20.799 DEBUG (MainThread) [rtsp_to_webrtc.web_client] request[get] http://192.168.1.228:8083/streams
2023-03-26 11:57:20.803 DEBUG (MainThread) [rtsp_to_webrtc.web_client] response <ClientResponse(http://192.168.1.228:8083/streams) [200 OK]>
<CIMultiDictProxy('Access-Control-Allow-Credentials': 'true', 'Access-Control-Allow-Headers': 'Content-Type, Content-Length, Accept-Encoding, X-CSRF-Token, Authorization, accept, origin, Cache-Control, X-Requested-With', 'Access-Control-Allow-Methods': 'POST, OPTIONS, GET, PUT, DELETE', 'Access-Control-Allow-Origin': '*', 'Content-Type': 'application/json; charset=utf-8', 'Date': 'Sun, 26 Mar 2023 15:57:20 GMT', 'Content-Length': '40')>
2023-03-26 11:57:20.803 ERROR (MainThread) [homeassistant.components.camera] Error handling WebRTC offer: RTSPtoWeb server returned malformed payload: None

Any thoughts on what the issue might be or next steps to troubleshoot? Im not totally clear on the networking requirements for this integration. The fact it works via RTSPToWeb UI makes me think my Docker / networking configuration is not the issue though.

Also, just to confirmā€¦ I donā€™t need to manually configure streams in RTSPtoWeb, right? It seems the integration takes care of out?

Likely the issue is related to the RTSPtoWeb network setup. You may need to turn up more debug logging and/or read the code to understand what else is needed, since you are not using host mode.

Yes

Hello Tom. Have you guys found out how to stream from Unifi Protect? I get the message: Failed to start WebRTC stream: RTSPtoWeb server failure: stream channel codec not ready, possible stream offline: Internal Server Error

@allenporter Hello. I get the error: Failed to start WebRTC stream: RTSPtoWeb server failure: stream channel codec not ready, possible stream offline: Internal Server Error

I use Unifi Protect. Any news on how to fix this? I saw that @TomBrien also mentioned this. For your information, I can see the camera picture for about 5 seconds, berfore the message appears. The camera picture is not a stream, itĀ“s just of a picture the camera feed the second I uploaded the glance picture card.

Does anyone have external streaming working with this? Iā€™ve tried changing STUN servers and different devices but still no joy. I have several Reolink cameras with the custom integration serving up their RTSP streams. They work OK externally with the RTSPtoWeb - WebRTC integration disabled but when I try to use WebRTC I get a still image but it wonā€™t play. Every time I refresh the image will refresh but no stream. Iā€™m trying to figure out whatā€™s stopping it and this is what I have concluded so far:

Not Working:

  • Android companion app with RTSP camera streams over 4G LTE via Nabu Casa URL
  • Windows Chrome via a hotspot on my mobile device, so 4G LTE via Nabu Casa URL
  • On both devices RTMP streams from Frigate stop playing externally via HA too

Working:

  • Internally, with direct local IP they work great, better than go2rtc.
  • Internally with Nabu Casa URL too.

Yes, it works. Just to be clear: you have RTSPtoWeb working internally?

Yes, pretty sure it is. Inspecting the page in chrome showā€™s this so Iā€™m assuming itā€™s the WebRTC stream

image

I have go2rtc working externally but I have to open port 8555 and forward it to my HA instance.

Yep, looks right. Typically itā€™s just a matter of the configuring the stun server in the integration config. This will cause it to be set in the JavaScript of that webrtc component in the frontend which should change how the peer connection between your browser and the go2rtc server. I have only tested on RTSPtoWeb myself but my impression is that go2rtc supports everything and more comparatively

I donā€™t need a go2rtc server for this to work though? I thought this was completely separate to go2rtc? I have the addon running and Iā€™ve added the integration and set the stun server to stun.l.google.com:19302

I think this may have something to do with my EE 4G/5G LTE connection I was testing on. Iā€™ve just switched to another network and itā€™s working. Not sure whatā€™s different about that, I remember something to do with asynchronous NAT mentioned with problems with go2rtc, so maybe thatā€™s it.

Correct, you donā€™t need go2rtc. I only mentioned it because you did. My impression is that its a drop-in replacement.

Ah OK I was getting confused for a minute there. As it looks like the STUN option doesnā€™t work for me, I think Iā€™ll go back to go2rtc. Unless there is a way of getting this to work without opening the cameras to the internet, AFAIK go2rtc just opens a port for STUN to the internet.

Another thing Iā€™ve noticed on a different HA instance, it seems the addon is consuming around 10% CPU just being idle,without the integration being enabled. When I do use it, it rises to around 40% usage. Something which I havenā€™t seen on my other instance. Not sure why this is as there doesnā€™t appear to be any issues in the logs.

s6-rc: info: service s6rc-oneshot-runner: starting
s6-rc: info: service s6rc-oneshot-runner successfully started
s6-rc: info: service fix-attrs: starting
s6-rc: info: service fix-attrs successfully started
s6-rc: info: service legacy-cont-init: starting
cont-init: info: running /etc/cont-init.d/01-rtsp-to-web
[13:59:36] INFO: Updating configuration
cont-init: info: /etc/cont-init.d/01-rtsp-to-web exited 0
s6-rc: info: service legacy-cont-init successfully started
s6-rc: info: service legacy-services: starting
services-up: info: copying legacy longrun rtsp-to-web (no readiness notification)
s6-rc: info: service legacy-services successfully started
[13:59:37] INFO: Starting discovery service
[13:59:37] INFO: Starting RSTPtoWeb
[13:59:37] INFO: Successfully send discovery information to Home Assistant (8083).

Definitely use go2rtc if it works well for you.

just to add i too am having issues accessing remotely i have added the stun server but its made no difference, restarted HA just in case. My setup is also duckdns port forward to nginx proxy, not sure what else to test