I have some Ubiquiti cameras and in Home Assistant there’s huge lag on the RTSP streams. I’ve tried all the suggestions in various threads I’ve found but none seem to have a conclusion or they find an issue that isn’t applicable to my setup.
If I enable the stream component the lag is around 15 seconds. Enabling and disabling preload has no impact. Using VLC to play the same RTSP URL is fine, about 1s lag as expected. I’ve tried switching RTSP bitrate and resolution but the lag is the same. The only suggestion I’ve found that I can’t test is changing the i-frame frequency, but it doesn’t look like I can do that with these cameras (yet).
If I disable the stream component and settle for a jpg every so often (I have a HikVision camera I do this for and it refreshes every second as configured and works fine) it won’t refresh any more than every 10 seconds. It doesn’t look to be transcoding or repackaging, and the delay stays exactly the same regardless of quality.
HA is running in a Docker container on a Linux machine with a Core i7 CPU and plenty of RAM on a wired 1Gb connection, CPU use is at a few percent.
Can anyone explain how it works under the hood and if there’s a solution here? 15s delay is long enough that it’s basically rendering the cameras useless, so I’d be really grateful for some help!