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

2 Likes

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:

3 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?