Add on: RTSPtoWeb and RTSPtoWebRTC

Did you stop/uninstall Alex’s WebRTC addon? You must do that or you won’t be able to start this new one.
But, i managed to add camera only to figured it out same thing as others: camera is not available from outside. Since in Alex’s addon camera IS available from outside i guess that i’ll stick with Alex addon for now.

1 Like

Alex addon? You mean his custom component, right?

I’m not getting this… WebRTC streams should be visible on the lovelace cards without having to open external ports right? It’s not working for me… I can view all streams internally using either camera entity or RTSPtoWeb GUI, but externally they all fail. The log says:

2022/02/03 21:30:51 http: panic serving 172.30.32.2:44344: write tcp 172.30.32.1:8083->172.30.32.2:44344: write: broken pipe
goroutine 4104 [running]:
net/http.(*conn).serve.func1(0xc0003b21e0)
	/usr/lib/go/src/net/http/server.go:1804 +0x153
panic(0xc86e40, 0xc00035b130)
	/usr/lib/go/src/runtime/panic.go:971 +0x499
github.com/gin-gonic/gin.(*Context).Render(0xc003004200, 0xc8, 0xe618e8, 0xc001986030)
	/root/go/pkg/mod/github.com/gin-gonic/[email protected]/context.go:928 +0x17c
github.com/gin-gonic/gin.(*Context).HTML(0xc003004200, 0xc8, 0xd56920, 0xa, 0xc72b40, 0xc000b110b0)
	/root/go/pkg/mod/github.com/gin-gonic/[email protected]/context.go:937 +0x99
main.HTTPAPIServerIndex(0xc003004200)
	/build/github.com/deepch/RTSPtoWeb/apiHTTPRouter.go:164 +0x237
github.com/gin-gonic/gin.(*Context).Next(...)
	/root/go/pkg/mod/github.com/gin-gonic/[email protected]/context.go:168
main.CrossOrigin.func1(0xc003004200)
	/build/github.com/deepch/RTSPtoWeb/apiHTTPRouter.go:313 +0x3c3
github.com/gin-gonic/gin.(*Context).Next(...)
	/root/go/pkg/mod/github.com/gin-gonic/[email protected]/context.go:168
github.com/gin-gonic/gin.(*Engine).handleHTTPRequest(0xc0003664e0, 0xc003004200)
	/root/go/pkg/mod/github.com/gin-gonic/[email protected]/gin.go:555 +0x2b0
github.com/gin-gonic/gin.(*Engine).ServeHTTP(0xc0003664e0, 0xe66630, 0xc0004b20e0, 0xc003004100)
	/root/go/pkg/mod/github.com/gin-gonic/[email protected]/gin.go:511 +0x16b
net/http.serverHandler.ServeHTTP(0xc0004b22a0, 0xe66630, 0xc0004b20e0, 0xc003004100)
	/usr/lib/go/src/net/http/server.go:2867 +0xa3
net/http.(*conn).serve(0xc0003b21e0, 0xe687e0, 0xc000ee0dc0)
	/usr/lib/go/src/net/http/server.go:1932 +0x8cd
created by net/http.(*Server).Serve
	/usr/lib/go/src/net/http/server.go:2993 +0x39b

Yes, i mean THIS custom component.Sorry, i wrote “addon” by mistake.

Yeah I reverted back too, too bad tough, really liked it…
But I need external access

1 Like

Hi Allen,

Thanks so much for your hard work with the add-on and integration. I have gotten it working.

I do find there is about 5-6 second delay for the feed to start. Sometimes the card is black and doesn’t load, the webpage needs to be refreshed to display the video.

Regards,
Sam

Why should we be using an add-on for this when the integration from Alex worked?

I too was confused when I went to integrations and it wanted a url. Text on the integration setup screen to say install the add-on first would help.

1 Like

See the explaination above about the differences. If you already are using the custom component and happy with it, i’m not sure you should do anything…

Integrations typically don’t have an opinion about where you run the server, so its not really appropriate to mention the add-on. For example, if you install motion eye integration it asks you for your motion eye url.

If you install the add-on first as described in this post, then it should get auto discovered. That is why I made this post.

This delay to start can be also be caused by camera itself. For picture to show you must receive camera’s mainframe, which is sent every n seconds (depends on camera settings, also called an “I” frame). That n can be very well 5 or more seconds, because with increasing it you save bandwidth. I have all cameras set to 2s, which is minimum for many cameras. Otherwise camera feed in this addon is pretty much live, without delay.

If you install the add-on first as described in this post, then it should get auto discovered. That is why I made this post.

Allen: Correct. It is auto discovered. Maybe it would be a good idea to mention in first post that the two (yours and Alex’s) are not compatible and can’t live together to save errors and troubles.

I hope that there’s no hard feelings… I didn’t mean anything bad by mentioning alternative, i admire your work, as much as all others who participate in HA. I love to use it, and i love to test all new things which are usable for me to see if there’s any new function to be used… But i’m only noob in programming. I know just that much that i’m aware that a lot of knowledge is needed in order to write and maintain all these things.

Thanks a lot!!!

Yeah, I wasn’t expecting people already using Alex’s custom component to need this. As mentioned above a few times, no need to switch away from the custom component of you’re already using it and happy with it.

1 Like

Hey @allenporter , I really like this addon, especially because the camera entities are now using webrtc… This was not possible on the Alex card…
But is MSE coming , so we can watch cameras remote?

If you’re using RTSPtoWeb check out https://github.com/deepch/RTSPtoWeb/blob/765414885c5f6cd9b922d1e1364d861c22b200ef/docs/api.md for the various APIs. However, almost all of these require some kind of html page to drive them. You can’t just load the webrtc endpoint, you have to have javascript open a webrtc channel for example.

Have you seen the dashboard at / where you can click and view the various streams using the RTSPtoWeb interface?

My impression is that RTSPtoWeb supports MSE here: https://github.com/deepch/RTSPtoWeb/blob/765414885c5f6cd9b922d1e1364d861c22b200ef/docs/api.md#mse though I am not aware of official support in home assistant for it. My impression is this the existing webrtc custom component uses a custom lovelace card.

Yes, maybe the card is making it possible indeed…
With Alex edition, the card is needed, with yours not, that makes it nice indeed…
So maybe it’s a frontend issue then

Yeah i don’t want to trivialize what it would take to make it “official”. Additionally, I think what is needed is to figure out how to plumb through the RTSP server address, etc likely involving changing the camera apis, etc.

The work for getting WebRTC a proposal like this for nest: https://github.com/home-assistant/architecture/discussions/640 and https://github.com/home-assistant/architecture/discussions/658 for getting this component to work. Something similar would be needed to make MSE official.

I think maybe what is interesting is to follow https://github.com/deepch/RTSPtoWebRTC/issues/148 – my impression is the existing recipe for the custom component involves port forward when not using MSE.

Edit: Also here is some context on a previous discussion about add-on vs custom component: https://github.com/AlexxIT/WebRTC/issues/138 and the pros and cons.

I’m running Raspbian OS with HA in Docker. While setting up the integration I have to fill some server. Which server should I run? Could you please give more information about it?

Hi, this forum post is about the Home Assistant OS Add-on that packages an existing project(s). You can use either https://github.com/deepch/RTSPtoWeb or https://github.com/deepch/RTSPtoWebrtc as described in the integration page

2 Likes

Hello anyone got it working with Eufy Cameras?

3 Likes

Thanks for putting this together, really is a huge improvement to the stream experience. Couple of things I’ve noticed.

  • It only works with the insecure from the UniFi Protect integration. Trying to access the secure feeds gives the error:

    Failed to start WebRTC stream: RTSPtoWeb server failure: stream channel codec not ready, possible stream offline: Internal Server Error
    1
    

    In the front end and:

    time="2022-02-05T11:19:31Z" level=info msg="Run stream" call=Run channel=0 func=StreamServerRunStreamDo module=core stream=camera.g4_doorbell_high
    time="2022-02-05T11:19:31Z" level=error msg="Stream error restart stream x509: certificate is valid for 127.0.0.1, fe80::1, not <PROTECT_SERVER_IP>" call=Restart
    

    In the add on logs

    - I get a connection_refused error when trying to open the web UI, I’m guessing this is a https issue or similar? ok needed a port forward, worth adding to the docs?

Let me know if you want me to spin either of these out into GitHub issues or if I’m missing something obvious

Thanks again, the is really such a huge improvement!

For anyone wondering how to run this with HA Docker installation:

  1. Get addon from allenporter (Allen Porter) / Packages (github.com) and run it with docker beside HA container

ie.

docker pull ghcr.io/allenporter/aarch64-rtsp-to-web:latest
  1. Configure HA Integration with URL to http://<your_ip>:8083
  2. Add Picture card with your camera as described at post #19

BTW great work, it really improved experience.

2 Likes