Closed lygris closed 3 years ago
Can you run top inside the container to see what is using so much CPU?
Here you go
Oh and I don't think I mentioned in the original post, this vm has 12 cores/24 threads and is running on e5-2650 v2 cpus and docker is reporting 40 - 60% cpu usage.
96 root 20 0 3702400 146924 5192 S 243.9 0.9 284:18.10 frigate.process
97 root 20 0 3703028 146692 5380 R 232.2 0.9 354:18.10 frigate.process
103 root 20 0 2319216 127832 2780 S 58.8 0.8 462:25.91 python3
98 root 20 0 2319216 127568 2504 S 58.5 0.8 463:11.32 python3
99 root 20 0 2319216 127188 2164 S 58.1 0.8 461:16.80 python3
106 root 20 0 2319216 126844 1816 S 58.1 0.8 462:47.45 python3
111 root 20 0 2319216 127376 2312 S 57.5 0.8 463:03.22 python3
115 root 20 0 2319216 127376 2308 S 57.5 0.8 462:15.40 python3
110 root 20 0 5220732 155084 116336 R 41.2 0.9 378:39.63 ffmpeg
113 root 20 0 5220920 151876 116864 R 41.2 0.9 375:55.32 ffmpeg
102 root 20 0 5220988 153276 116276 R 40.9 0.9 377:56.49 ffmpeg
127 root 20 0 5220924 156028 117108 R 40.9 1.0 377:33.46 ffmpeg
121 root 20 0 5220884 153652 116796 R 40.5 0.9 378:15.77 ffmpeg
118 root 20 0 5220888 155680 116808 R 39.9 0.9 378:31.55 ffmpeg
24464 root 20 0 5234716 171904 125736 R 27.9 1.0 134:58.98 ffmpeg
24364 root 20 0 5253440 166908 125648 S 27.6 1.0 143:17.22 ffmpeg
1 root 20 0 4423904 266372 7704 S 22.3 1.6 180:23.78 python3
74 root 20 0 2213064 132732 6780 S 17.9 0.8 41:37.74 frigate.detecto
126 root 20 0 2384752 128788 4288 S 16.3 0.8 204:19.48 python3
122 root 20 0 2384752 128600 4168 S 15.9 0.8 204:57.38 python3
77 root 20 0 3698960 146556 5364 S 6.0 0.9 236:51.78 frigate.process
80 root 20 0 3704264 150836 5240 S 6.0 0.9 57:18.85 frigate.process
81 root 20 0 3699100 145560 5540 S 6.0 0.9 50:41.47 frigate.process
85 root 20 0 3691404 137720 5052 S 6.0 0.8 80:07.00 frigate.process
78 root 20 0 3699076 146028 5396 S 5.6 0.9 39:38.06 frigate.process
83 root 20 0 3698944 145460 5088 S 5.6 0.9 99:10.93 frigate.process
73 root 20 0 14524 5180 168 S 4.7 0.0 29:04.23 python3
20 nobody 20 0 19836 8580 1860 S 3.0 0.1 34:45.87 nginx
19 root 20 0 16416 3236 0 S 0.0 0.0 0:00.00 nginx
69 root 20 0 1978632 102348 1996 S 0.0 0.6 0:03.71 frigate.logger
14243 root 20 0 2616 580 512 S 0.0 0.0 0:00.04 sh
14250 root 20 0 6240 3180 2672 R 0.0 0.0 0:00.09 top ```
@blakeblackshear I realized the pid with the high cpu usage is whichever camera at the time has a lot of motion? Not sure if recording is using a lot of cpu or if it's something else triggered by motion/object detection? Would that make any sense?
The pid for ffmpeg? There are at least 3 pids for each camera.
@blakeblackshear on the debug tab it is just labeled "pid" so in this case today pid 93 was over 800 in top when 2 people were in my living room today sitting on the couch with slight movement. Whichever camera has a decent bit of motion in it, has the "frigate.process" pid for that camera spike in cpu usage.
That process performs motion detection on the frames coming from the camera and then prepares regions for object detection based on detected motion. It should have higher CPU usage when there is motion being detected.
That process performs motion detection on the frames coming from the camera and then prepares regions for object detection based on detected motion. It should have higher CPU usage when there is motion being detected.
@blakeblackshear Is it possible to have my gpu do the motion detection as well as encoding/decoding?
I switched to frigate from shinobi because of the cameras dropping out occasionally and wanting better object detection but if frigate is going to use ~8-16 cores at 100% when motion is detected I'm not sure I can keep running it.
It's not possible for the GPU to run motion detection, and it's not even the most CPU intensive thing happening in that process. Those processes should not be using 8-16 cores for that number of cameras. I run 7 1080p cameras on an i3 NUC and it doesn't even use 1 core at 100%.
Have you looked at the debug view with motion boxes on for your cameras? You may need motion masks for things like timestamps. Your detection FPS should stay near zero when there is no motion of interest.
Also, you should set your fps for all cameras to 5. That won't impact the FPS for clips or rtmp, but it will limit the fps for analysis.
@blakeblackshear the motion masks looks like they helped alot, granted nobody is at home right now besides me but it's looking better. One thing I noticed is my clips don't have audio, I tried adding the following to a camera but it didn't seem to work. Must be missing something.
- -c:a
- aac
Missed the part about overriding the -an setting
Also is there a way to view multiple cameras at once kind of like a "cctv" monitor? If not is that a planned feature or is there another way for me to accomplish that with home assistant or another program?
Figured that part out with home assistant
Thank you for all the help, it's greatly appreciated!
Describe the bug I'm using the nvidia container and a pci tpu, but CPU usage is high with 8 cameras. By running nvidia-smi I can see 8 ffmpeg processes using the GPU so i'm a little lost.
Version of frigate Output from
/api/version
0.8.4-5043040Config file
I get these a lot it seems but not sure if it's relevant Frigate container logs
Frigate stats
FFprobe from your camera
Run the following command and paste output below 6 of these cameras
2 of these cameras
Screenshots If applicable, add screenshots to help explain your problem.
Computer Hardware
Camera Info:
Additional context Add any other context about the problem here.