-
-
Notifications
You must be signed in to change notification settings - Fork 1.8k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[Support]: Nvidia - High Cpu Usage #3425
Comments
What CPU do you have? Low cpu usage isnt necessarily guaranteed with GPU, is it constant and how much motion do see if you view the debug camera view with motion boxes? GPUs only help with video decoding |
The screenshots you posted of the ffmpeg processes show command args that don't match the config you posted. Can you post your actual yaml config? |
Xeon E-2224G I have turned off Detect, Recording & Snapshot from Frigate UI, similar cpu usage. Low motion boxes. CPU usage: +30% Can nvidia help with output rtmp ? |
Rtmp is just a copy of the stream. It doesn't require any meaningful CPU work. |
Config File #1 Cam. database:
path: /db/frigate.db
mqtt:
host: 192.168.1.70
user: mqttuser
password: mqttuser
topic_prefix: frigate
ffmpeg:
input_args:
- -c:v
- h264_cuvid
cameras:
### CAM Driveway
03driveway:
ffmpeg:
hwaccel_args:
- -c:v
- h264_cuvid
inputs:
- path: rtsp://user:[email protected]/ch1/main
roles:
- detect
- path: rtsp://user:[email protected]/ch1/main
roles:
- record
- rtmp
detect:
width: 1280
height: 960
fps: 5
objects:
track:
- person
- car
- cat
- dog
- bicycle
- skateboard
- motorcycle
- bus
motion:
mask:
- 490,40,1280,43,1280,0,492,0
zones:
Rampa:
coordinates: 1280,960,1280,766,1280,799,1280,0,1121,0,1060,427,526,189,524,84,449,0,280,0,0,0,0,960
objects:
- person
- cat
- dog
live:
quality: 5
height: 960
snapshots:
enabled: True
crop: False
bounding_box: True
clean_copy: True
timestamp: True
quality: 100
record:
enabled: true
retain:
days: 15
mode: all
events:
objects:
- person
- cat
- dog
retain:
default: 15
mqtt:
timestamp: False
bounding_box: False
crop: True
quality: 100
height: 500
detectors:
#coral:
# type: edgetpu
# device: usb
cpu1:
type: cpu
num_threads: 3
cpu2:
type: cpu
num_threads: 3
birdseye:
enabled: True
width: 1920
height: 1080
quality: 5
mode: continuous |
ffmpeg process list: root@omv:~# ps aux | grep ffmpeg root 1509567 0.0 0.1 115684 17456 ? Ss 16:44 0:00 ffmpeg -f rawvideo -pix_fmt yuv420p -video_size 1280x960 -i pipe: -f mpegts -s 1280x960 -codec:v mpeg1video -q 5 -bf 0 pipe: root 1509569 0.0 0.1 115684 17500 ? Ss 16:44 0:00 ffmpeg -f rawvideo -pix_fmt yuv420p -video_size 1280x720 -i pipe: -f mpegts -s 1280x720 -codec:v mpeg1video -q 8 -bf 0 pipe: root 1509575 24.1 1.1 5328480 185468 ? Ssl 16:44 0:02 ffmpeg -hide_banner -loglevel warning -c:v h264_cuvid -avoid_negative_ts make_zero -fflags nobuffer -flags low_delay -strict experimental -fflags +genpts+discardcorrupt -use_wallclock_as_timestamps 1 -i rtsp://user:[email protected]/ch1/main -f segment -segment_time 10 -segment_format mp4 -reset_timestamps 1 -strftime 1 -c copy -an /tmp/cache/03driveway-%Y%m%d%H%M%S.mp4 -c copy -f flv rtmp://127.0.0.1/live/03driveway -r 5 -s 1280x960 -f rawvideo -pix_fmt yuv420p pipe: |
You have specified the database:
path: /db/frigate.db
mqtt:
host: 192.168.1.70
user: mqttuser
password: mqttuser
topic_prefix: frigate
cameras:
### CAM Driveway
03driveway:
ffmpeg:
hwaccel_args:
- -c:v
- h264_cuvid
inputs:
- path: rtsp://user:[email protected]/ch1/main
roles:
- detect
- path: rtsp://user:[email protected]/ch1/main
roles:
- record
- rtmp
detect:
width: 1280
height: 960
fps: 5
objects:
track:
- person
- car
- cat
- dog
- bicycle
- skateboard
- motorcycle
- bus
motion:
mask:
- 490,40,1280,43,1280,0,492,0
zones:
Rampa:
coordinates: 1280,960,1280,766,1280,799,1280,0,1121,0,1060,427,526,189,524,84,449,0,280,0,0,0,0,960
objects:
- person
- cat
- dog
live:
quality: 5
height: 960
snapshots:
enabled: True
crop: False
bounding_box: True
clean_copy: True
timestamp: True
quality: 100
record:
enabled: true
retain:
days: 15
mode: all
events:
objects:
- person
- cat
- dog
retain:
default: 15
mqtt:
timestamp: False
bounding_box: False
crop: True
quality: 100
height: 500
detectors:
#coral:
# type: edgetpu
# device: usb
cpu1:
type: cpu
num_threads: 3
cpu2:
type: cpu
num_threads: 3
birdseye:
enabled: True
width: 1920
height: 1080
quality: 5
mode: continuous |
Using the following settings cpu usage has dropped to 8-9%, 2560x1440 camera. I don't know if it can be improved or the result is what is expected ? Could the GPU encoder be used to further improve other process or lower the load on the cpu ? Nvidia recommends this ffmpeg settings to keep all processing in GPU. https://developer.nvidia.com/blog/nvidia-ffmpeg-transcoding-guide/ -hwaccel cuda -hwaccel_output_format cuda
|
Looks like it's working well and some CPU usage like that makes sense as motion detection and other frigate processing have to use CPU. I don't think cuda output format would help since it would need to be converted to yuv420 anyway which would use CPU |
Frigate Version: 0.11.0-1D45B0B DELL PowerEdge T40 Xeon E-2224G 16 GiB Memory Operating system: Debian Install method: Docker Compose Coral version: NO Coral (waiting for delivery since weeks ago) Network connection: Wired Camera make and model: Hikvision IPC-D150H-M [h264 2560x1920 Main stream 12 fps] 11 cameras running with 'simple' hwaccel_args, like this one: Test made in camera 03driveway I am testing three scenarios to try reduce CPU use. To do that I bought Nvidia graphics card exclusively for this.
03driveway:
03driveway:
03driveway:
Nvidia card never goes beyond 10% except when starting Frigate (the is up to 28% during for a second) I am not a pro so I need extra help. I see there are no encoder use from Nvidia. One of my questions is if this is the most I can get from the graphics card. I am using the record stream from main stream, because I saw that Frigate gives the live view resolution from the record settings, that do not allow me to use a sub stream for detection. Is there a the right ffmpeg settings? I do not if this is the same that Nvidia recommends or if it not compatible with Frigate. Am I wrong about all of this? Thank you in advance for your help |
hwaccel_args:
-hwaccel cuda
input_args:
-avoid_negative_ts make_zero
-fflags +genpts+discardcorrupt
-rtsp_transport tcp
-stimeout 5000000
-use_wallclock_as_timestamps 1
-hwaccel cuda please do not double up your hwaccel args, they should only be put under
Frigate does not use GPU for encoding, only decoding the incoming stream from the camera
As far as standard frigate is concerned I believe it is, things seem to be working well so I don't know what else to look at. I would keep it with the "simple" args and leave it at that as they seem to work best. Those are the args recommended by the docs. Depending on what GPU you have, you may be able to use the TensorRT cores to run faster object detection via this thread. Keep in mind though that this is not apart of frigate directly (yet anyway) and has no guarantee of stability. |
Thanks Nick, I'm sorry I copied the wrong settings, I just update the pst so this is the actual camera config settings from the three test I made. About the resolution for the record settings? Is there a possibility to have one source for detection and other for Frigate's cam viewer? |
The detect process is the only stream that is decoded, and it needs to be decoded before showing in the frontend so there is no way to use the higher quality stream in the frontend but not for detection itself. |
Describe the problem you are having
I experience high CPU usage even while using Nvidia GPU
Version
0.11.0-1D45B0B
Frigate config file
Relevant log output
FFprobe output from your camera
Frigate stats
Operating system
Debian
Install method
Docker Compose
Coral version
Other
Network connection
Wired
Camera make and model
Hikvision IPC-D150H-M
Any other information that may be helpful
Host HTOP
Host NVIDIA-SMI
Container NVIDIA-SMI
The text was updated successfully, but these errors were encountered: