WTH: Why is camera streaming still so slow, CPU heavy and of little use?

One of my main uses of Home Assistant is to use it as a surveillance and alerting device for my home.
I have integrated several ONVIF and generic cameras to display camera pictures.
All of the cards allow a live stream when clicked upon.
There’s also a stream being sent to my Google Nest Hub.

The thing is that all of those streams have a severe lag of around 10-30 seconds. And it’s really hard to get to the bottom of this or find ways around it. As far as I was able to understand it’s because the streams are decoded by HA and then resent or displayed. That also makes the CPU sweat. And it sometimes pushes my Raspberry over the edge.

I wish there was an overhaul to this so that camera streams can be displayed in the UI and be sent to other devices with no or minimal delay. It would also reduce CPU load for those cases.
How awesome would this be?

Have you ever checked webrtc custom integration or rtsptowebrtc add-on or go2rtc add-on? they may not resolve being CPU intensive but they are fast

Yes, I have at times looked at those. Thanks for the links, I’ll give it another go.
However I don’t see the option to seamlessly stream this to a Google Nest Hub, which I need.
Also those installations are kind of the point. It’s far from easy to use and integrated. It’s usually cumbersome and error prone to get it working.

Webrtc should a service call to cast on devices

It is my experience that webrtc works great for cards on for example RTSP streams (pretty much live) but not so much when you need to cast this or record the stream itself.

@alexfooley i would use something like this:

type: custom:webrtc-camera
url: >-
  rtsp://127.0.0.1:554/user=admin&password=fubar&channel=1&stream=0.sdp?real_stream--rtp-caching=100
title: Back Porch
muted: false
background: false

You will have to adjust the url settings for what your camera supports (there’s websites that show what arguments you can give for your make of camera)

1 Like

Not sure about casting, but I use the frigate custom card (you do not need to use frigate). This is a real hidden jem with an awesome GUI config. It has an option to change refresh rate on rtsp streams that works. Get the best of both worlds, low lag and low refresh rate (1 frame every 2 seconds), so it doesn’t hog bandwidth. Add the card, pick your camera entity, then in “View” set “Static Image” and in “Image” set refresh rate. It has lots of settings to get things to your liking.

https://github.com/dermotduffy/frigate-hass-card

1 Like

Nice suggestion.

Yeah i mean i haven’t tested the record or snap shot camera services but i changed some of my RTSP streams (which work realtime using the webrtc card) to the camera integration and when i use the camera.stream service to a chromecast, it’s just slow, even when set to 30/60 fps, probably lagging about a minute behind.