Realtime camera streaming without any delay - WebRTC

Excellent addition to HA. Less than a fraction of a second delay.

Got my Reolink 4505MP working in second. Now only if this could be made into a Lovelace card

1 Like

Did anyone figure out a way to show only the stream (the video), without the other parts of the webpage? Maybe some kind of deep link? This could help have a nicer iframe :slight_smile:

2 Likes

Exactly. Looks like it shouldn’t be trivial to pull off. You could even take out the buttons and details and just have the camera feed in its own lovlace. That would solve so many issues.

2 Likes

Interested in this but as everyone else says, need a lovelace view

Only got sound with no video using the same rtps:// uri that work fine in VLC.
No issue when using with Onvif integration in HA except a lag in video stream, that is the point I would like to optimize with your add-on.
By the sound i can hear when i launch ptz movements i can say it is far away to be the best solution in term of lag, there is absolutely no delay !.. but no video stream for me :frowning:

Codec is H264 and log doesn’t seem to report errors :

[GIN] 2021/02/03 - 18:28:12 | 200 |     795.125µs |   192.168.1.101 | GET      "/?player=Besder+MainStream"
[GIN] 2021/02/03 - 18:28:12 | 200 |      268.99µs |   192.168.1.101 | GET      "/static/js/app.js?ver=2021-02-03+18:28:12.50453933+%2B0100+CET+m%3D%2B314.645054753"
[GIN] 2021/02/03 - 18:28:12 | 200 |      147.76µs |   192.168.1.101 | GET      "/codec/Besder MainStream"
2021/02/03 18:28:12 Stream Try Connect Besder MainStream
2021/02/03 18:28:12 Set UDP ports to 50000..50009
2021/02/03 18:28:12 Stream Exit Rtsp Disconnect
2021/02/03 18:28:13 Stream Try Connect Besder MainStream
2021/02/03 18:28:14 Stream Exit Rtsp Disconnect
2021/02/03 18:28:15 Stream Try Connect Besder MainStream
2021/02/03 18:28:15 Stream Exit Rtsp Disconnect
2021/02/03 18:28:16 Stream Try Connect Besder MainStream
2021/02/03 18:28:17 Stream Exit Rtsp Disconnect
[GIN] 2021/02/03 - 18:28:17 | 200 |  5.040426495s |   192.168.1.101 | POST     "/recive"

My camera is cheap chinese Goke firmware based. Model is EYEPLUS_DEV P05-7 and is normally intended to work with YCC365 Plus app(Cloud).

Any advice for custom paremeters/tuning that could help me to get video displayed ?

EDIT :
By changing URI to get video only stream(without audio) I got an error(functional on VLC):

[GIN] 2021/02/03 - 18:40:01 | 200 |        9.25µs |   192.168.1.101 | GET      "/codec/Besder Mainstream video only"
2021/02/03 18:40:01 Stream Codec Not Found

Does the Stream Codec can be forced to h264 ?

I’ve found that project that work amazingly well without any delay:

Tested with

  docker run -p 8000:8000 -it mpromonet/webrtc-streamer -n mycam -u rtsp://mycam:554/0/v0

but it is also possible to load a config.json for more streams.
Not as simple as your add-on but it work perfectly well on my device

1 Like

Can you get it to display as a Lovelace card?

2 Likes

It could be as it comes with a webcomponent and can be embeded with that simple code :

<html>
	<head>
      <script type="module" src="webrtc-streamer-element.js"></script>
	</head>
	<body>
	   <webrtc-streamer url="mycam" webrtcurl="http://127.0.0.1:8000/" options="rtptransport=tcp&timeout=60" notitle width=800 height=600></webrtc-streamer>
	</body>
</html>
3 Likes

+1 for the ability to embed in Lovelace as a card

+1 too !!!

All wants lovelace card but no one wants to do it :slight_smile:

2 Likes

Touché (◠‿◕)

Can we use this as a base point?
https://github.com/custom-cards/surveillance-card

I’ve started to make one yesterday, but on the webrtc-streamer project because that topic’s project doesn’t work for my cam.
I use an existing custom card as I don’t have any skills on lovelace card developpment.

I do have a functionnal card that play 0 delay rtsp stream through webrtc.
It is not streamable anywhere else than in a browser due to webrtc but it’s nice for “realtime” PTZ positioning.
Don’t know how it will work with external connexion / stun server or VPN, didn’t tested yet.

This very simple card could also be adapted for this topic project, enhanced with interface ptz button…
Someone could also make an addon for wertc-streamer as it meant to support lot more than just h264…

4 Likes

i have the same issue…

I gave webrtc-streamer a shot, as I’m a little desperate for a webrtc solution that I can use in lovelace… but that project ate my nuc’s CPU alive. Alex’s add-on, on the other hand, has near no CPU impact when pulling in the same rtsp stream. But obviously no card yet supports Alex’s add-on, and I’m also not a JS wizard, so I’ll be paying close attention to this thread :slight_smile:

I have 1 tp-link c200 and 4 hikvision.
For tp-link there is an integration (https://github.com/JurajNyiri/HomeAssistant-Tapo-Control) that we have the option of using the HA stream or not (without delay).
It would be interesting to have this option for other camera models.

As I can see, this component using usual mjpeg format with ffmpeg convertation on Hass server.

This is great, thanks for making it. I use it for my hacked Yi Dome Guard, and compared to Onvif and other integrations like generic platform, it has almost no delay, compared to 5+ seconds delay with other methods. Also, it is very cpu light, compared to MotionEye which kills the cpu.

Just one thing - please oh please make a lovelace card for it, would be perfect to have it on my dashboard. Thanks.

Hi, @AlexxIT again a very nice addon. Tested on yicam + hack which also works great accept one with sound doesn’t seem to be able to have it run with sound. For my sonoff cam work without any problem. BTW will there be a future in running multiple streams at the same time?