HA Dashboard camera stream is not smooth

I have a generic IP camera setup in HA and it works great, when I click on it in HA I get the full screen view and it streams in real time with very little lag. I have added this entity to my HA Dashboard (ADv4) and it does show the camera, but the stream is choppy not showing the smooth live stream instead it looks like it is a still picture refreshing at random times. Sometimes every second, sometimes it will skip ahead 2-4 seconds before it refreshes. Any tips to get a smooth stream like I see in the HA view would be great. This is what I have for it in the dashboard config:

driveway:    
    widget_type: camera
    base_url: http://10.1.1.49:8123
    entity: camera.front_camera
    stream: 1

The docs says you should have

stream: "on"  # not 1, but I suspect that both work.

This might be a lot more info than you are asking for, but it explains the issue:

The camera stream in the Home Assistant UI is different from the camera stream that can be accessed through the Home Assistant API which is used by the HADashboard camera widget.

When you open a camera stream in the Home Assistant UI, Home Assistant runs an ffmpeg command that produces a number of randomly named .ts files, each 1 second long, and a .m3u8 playlist file which is used to display the camera stream in a HTML5 video tag. The ffmpeg command is only running when a camera stream is used in the Home Assistant UI. This is a good way of protecting the camera stream from being accessed by a hacker.

The stream that can be accessed through the Home Assistant API has a lower quality and produces a stream that is restarted every 5 minutes and that can be accessed by a changing token which is added to the stream url to protect the camera stream from hackers.

The Home Assistant UI camera stream is as far as I know still undocumented. We could ask to have this documented and then HADashboard could implement the same way of accessing the camera stream with the same high quality. What needs to be documented is how to start and stop the stream, and how to get the url of the .m3u8 playlist.

Thanks for the great detail, that does help explain it. I had seen that about on, but left off the " " when I had tried using it so it wouldn’t load the dashboard which is what caused me to use 1. I did change to “on”, but you are correct it appears pretty much the same quality as before. Yes it would be great if we could create a smoother stream on the video front since the rest of HA Dashboard works so well. I assume there is no way to direct link from HA Dashboard to the camera and skip tying it to the HA entity or if that would even help with the quality?

You can show the stream directly from the camera in HADAshboard by using an iframe widget instead. See here: https://appdaemon.readthedocs.io/en/latest/DASHBOARD_CREATION.html#iframe

Just use the img_list: option in the second example and put the url of your camera in the list. This will however only work if your camera produces an mjpeg stream. It does not work with rtsp streams. Most IP cameras have urls for both mjpeg and rtsp streams.

Thanks again, I will check that out. I know I am using the RTSP stream now but maybe I can find a good quality mjpeg one.

I’m using you camerastream app, but playback is still choppy. Using an i-frame completely bogs down my switch with all the streams to tablets around my house. RTSP streams to HA work amazing with barely any network load, but still it seems impossible to capture that feed in appdaemon.

Do you have any suggests in 2021 on how this might be done better?

I recently moved to using Blue Iris for my camera NVR and the Blue Iris HA integration and it is night and day with performance. My single camera streams on the dashboard are very smooth and there is no delay from real time (sub one second delay) so I am much happier with this setup.

Thanks, I’ve been using Blue Iris for years. The problem with bringing any streams into HA is it appears to waste cycles converting it to FFMPEG. Huge waste of resources and produces a subpar stream when compared to the streams imported. I’m just using the MPEG streams via iframes for now. No reason to import the stream into HA and bring use the camera entity in Appdaemon. Neither handle video well.

The Blue Iris HA integration doesn’t seem to offer any benefits, other than an easy way to utilize sensors.