UniFi Cameras Live view causes 100% CPU

I have 2024.11.3 running in a VM on my Synology. I have my system integrated with UniFi network for years without issue. About a year ago, I integrated with UniFi protect cameras. I only have two. For months, these were live view in my dashboard with no issues.

I’m not sure which release caused it, but it started late Oct or early Nov. I no longer can do any form of live view of the cameras. I have to leave it on auto. The second I do so, my CPU jumps to 100% and stays there, even if I close the window. It doesn’t matter whether I change the card from auto to live, or if I click on the card when it’s already on auto. It doesn’t matter if I click on the play button or not. Once you attempt to go anywhere near live view, the CPU spikes to 100%.

I changed nothing in my config. All I did was upgrade. Like I said, this was working perfectly for months with live view.

UniFi Network and Protect are both at the latest versions.

I’d suggest reading the release notes, especially the bit about WebRTC transcoding:

If this helps, :heart: this post!

My understanding is the UniFi camera streams are RTSPS and WebRTC. These release notes suggest that it would get better, not many times worse.

Edit: Also, it should be noted that my system does not depend on the cloud. It’s all local, so WebRTC wouldn’t necessarily be in play anyway since I’m not stream from the web. It’s done with Real Time Streaming Protocol (RTSPS) directly from the camera.

Again, I did not change any configuration. All I did was upgrade, and I always read most of the release notes. This worked for months without issue. Adding WebRTC support should not bump my CPU from 12% to 100% (my 30 years building software tells me that).

1 Like

Interestingly, I remember one other strangeness about this. It doesn’t always immediately go to 100% cpu. There have been times when I was experimenting where it was fine for several hours, but then it would jump back to 100% for no apparent reason. I say no apparent reason because my cameras are on their own view. I will purposely avoid that view and check a separate view that has my system status of HA, my NAS, batteries, etc. This is where I see the CPU jumping to 100%, and that is conformed when I check out the VM status directly. The camera view was not access by me.

I see quite a few posts about the CPU usage rising with different cameras after the latest HA core update.

Maybe it is related to this issue.

1 Like

I’m also a software Engineer with similar time on the keyboard, and I’m not surprised at anything, until it’s been instrumented, tested, and measured.

Here’s a CPU plot of a Yellow linked to a Unifi DMPro and a mix of G3/G4/G5 cameras with medium-res feeds configured.

Can you guess when I switched HA tabs to display live camera feeds, then stopped? :slight_smile:
image

The CPU was not pegged at 100%, but I don’t know the comparative codec optimisation/ hardware support of a RPi4 verses a Synology NAS. The design might be designed more for bus throughout than computation tasks.

Both memory and RPi4 (CM4) CPU increased significantly in a quick test, and after switching tabs away from video (presumably closing down transcoding), the CPU load dropped back but took ~5mins to fully drop back to the previous ~2% quiescent level suggesting there may be some processes left running to speed up a reload.

I’d suggest trying medium-res feeds in the Unifi integration in case the transcoding of high-bitrate video is the root cause.

(I believe everything is local in this architecture - no cloud. That is unless you connect remotely and a Nabu Casa STUN/ TURN server is used to detect and optimise the media path and stream directly to your remote endpoint.)

I think I recall a time way back when there were a bug that caused the camera feeds not to terminate once being initiated.
It is probably years back, but the changes to cameras in the latest update can have revived it or something similar to it.

When my system is working normally, I don’t see any significant bump in CPU or memory when camera feeds are shown (host CPU stays at 14-20%). The Synology 1520+ is a celeron (2Ghz with 4 cores). I also have a plex docker container on the host that can easily transcode multiple 4k feeds.

Right now, my system is showing a live feed from the 2k bullet camera. CPU on the Synology host is 14%, and the HA VM is at 20% CPU and 40% memory (VM is 1 core and 3GB RAM). I will continue to watch and see if it eventually jumps to 100%. I don’t see it gradually rise. It will jump from 15% straight to 100%, and it never goes back down until I restart HA.

I can try medium feeds next, but remember that this worked with high feeds for many months.

That didn’t take long (10 minutes). Jumped to 100% in HA. Memory didn’t change.

Definitely seem to go south once I upgraded, so definitely likely related to an update.