frigate
frigate copied to clipboard
Which hardware acceleration config?[Config Support]:
Describe the problem you are having
Now that I have my 10 cameras set up and working, I'm down to the fine performance tuning.
I'm confused as to which hardware acceleration setting to use
I am running Frigate as an HA add-on on a Dell Optiplex 3040, and HA reports it as a X86-64.
Which hwaccel settings should I be using?
BTW, this is such an awesome asset!
Version
0.10.1-83481AF
Frigate config file
mqtt:
host: 10.0.1.105
port: 1883
topic_prefix: frigate
client_id: frigate
user: ashscott
password: brillig269
stats_interval: 60
database:
path: /media/frigate/clips/frigate.db
timestamp_style:
position: "tl"
format: "%m/%d/%Y %H:%M:%S"
color:
red: 255
green: 255
blue: 255
thickness: 2
effect: shadow
detectors:
# cpu1:
# type: cpu
coral:
type: edgetpu
device: usb
# resolution was 640x352 changed to 1920x1080
cameras:
driveway: # <------ Name the camera
ffmpeg:
inputs:
- path: rtsp://admin:******@10.0.1.109:554/12 # <----- Update for your camera
roles:
- detect
- path: rtsp://admin:******@10.0.1.109:554/11 # <----- Update for your camera
roles:
- record
rtmp:
enabled: False # <-- RTMP should be disabled if your stream is not H264
detect:
width: 1920 # <---- update for your camera's resolution
height: 1080 # <---- update for your camera's resolution
fps: 5
objects:
track:
- person
- car
- horse
filters:
person:
threshold: 0.5
min_score: 0.75
car:
threshold: 0.5
min_score: 0.85
motion:
mask:
- 0,332,1920,453,1920,0,0,0
threshold: 15
zones:
driving:
coordinates: 0,488,0,382,650,435,1782,525,1783,568
objects:
- person
- car
horses:
coordinates: 0,1075,1915,1080,1920,685,1220,738,372,695,2,680
objects:
- horse
record:
enabled: True
retain:
days: 2
mode: all
events:
retain:
default: 5
mode: motion
pre_capture: 3
post_capture: 15
snapshots:
enabled: true
timestamp: false
bounding_box: false
crop: true
height: 500
retain:
default: 5
mqtt:
timestamp: False
bounding_box: False
crop: True
height: 500
quality: 100
turning_circle: # <------ Name the camera
ffmpeg:
inputs:
- path: rtsp://admin:******@10.0.1.119:554/12 # <----- Update for your camera
roles:
- detect
- path: rtsp://admin:******@10.0.1.119:554/11 # <----- Update for your camera
roles:
- record
# - rtmp
rtmp:
enabled: False # <-- RTMP should be disabled if your stream is not H264
detect:
width: 1920 # <---- update for your camera's resolution
height: 1080 # <---- update for your camera's resolution
fps: 5
objects:
track:
- person
- car
- dog
filters:
person:
threshold: 0.5
min_score: 0.75
car:
threshold: 0.5
min_score: 0.85
dog:
threshold: 0.5
min_score: 0.7
motion:
mask:
- 10,0,1920,0,1908,37,988,33,995,92,935,97,860,90,868,40,655,13
# zones:
# circle:
# coordinates: 0,23,0,137,0,352,640,352,640,107,640,24,470,17,336,3,332,33,288,28,290,4
record:
enabled: True
retain:
days: 2
mode: all
events:
retain:
default: 5
mode: motion
pre_capture: 3
post_capture: 15
snapshots:
enabled: true
timestamp: false
bounding_box: false
crop: true
height: 500
retain:
default: 5
mqtt:
timestamp: False
bounding_box: False
crop: True
height: 500
quality: 100
car_park: # <------ Name the camera
ffmpeg:
inputs:
- path: rtsp://10.0.1.118:554/12 # <----- Update for your camera
roles:
- detect
- path: rtsp://10.0.1.118:554/11 # <----- Update for your camera
roles:
- record
rtmp:
enabled: False # <-- RTMP should be disabled if your stream is not H264
detect:
width: 1920 # <---- update for your camera's resolution
height: 1080 # <---- update for your camera's resolution
fps: 5
objects:
track:
- person
- car
- dog
filters:
person:
threshold: 0.5
min_score: 0.7
car:
threshold: 0.5
min_score: 0.85
dog:
threshold: 0.5
min_score: 0.7
motion:
mask:
- 0,110,147,98,312,73,723,92,1080,93,1918,45,1913,3,358,0,0,0
zones:
carpark:
coordinates: 1025,367,1070,267,1510,228,1612,277,1838,427,1377,745,1212,657,1105,592,1068,528,1068,472
record:
enabled: True
retain:
days: 2
mode: all
events:
# required_zones:
# - arriving
retain:
default: 5
mode: motion
pre_capture: 3
post_capture: 15
snapshots:
enabled: true
timestamp: false
bounding_box: false
crop: true
height: 500
retain:
default: 5
mqtt:
timestamp: False
bounding_box: False
crop: True
height: 500
quality: 100
south_terrace: # <------ Name the camera
ffmpeg:
inputs:
- path: rtsp://admin:******@10.0.1.125:554/12 # <----- Update for your camera
roles:
- detect
- path: rtsp://admin:******@10.0.1.125:554/11 # <----- Update for your camera
roles:
- record
rtmp:
enabled: False # <-- RTMP should be disabled if your stream is not H264
detect:
width: 1920 # <---- update for your camera's resolution
height: 1080 # <---- update for your camera's resolution
fps: 5
objects:
track:
- person
- dog
filters:
person:
threshold: 0.5
min_score: 0.75
dog:
threshold: 0.5
min_score: 0.7
motion:
mask:
- 1920,0,1920,488,1018,378,0,365,0,0
record:
enabled: True
retain:
days: 2
mode: all
events:
retain:
default: 5
mode: motion
pre_capture: 3
post_capture: 15
snapshots:
enabled: true
timestamp: false
bounding_box: false
crop: true
height: 500
retain:
default: 5
mqtt:
timestamp: False
bounding_box: False
crop: True
height: 500
quality: 100
garage_south_east: # <------ Name the camera
ffmpeg:
inputs:
- path: rtsp://admin:******@10.0.1.42:554/12 # <----- Update for your camera
roles:
- detect
- path: rtsp://admin:******@10.0.1.42:554/11 # <----- Update for your camera
roles:
- record
rtmp:
enabled: False # <-- RTMP should be disabled if your stream is not H264
detect:
width: 1920 # <---- update for your camera's resolution
height: 1080 # <---- update for your camera's resolution
fps: 5
objects:
track:
- person
- dog
filters:
person:
threshold: 0.5
min_score: 0.75
dog:
threshold: 0.5
min_score: 0.7
motion:
mask:
- 1920,0,1920,275,0,518,0,0
record:
enabled: True
retain:
days: 2
mode: all
events:
retain:
default: 5
mode: motion
pre_capture: 3
post_capture: 15
snapshots:
enabled: true
timestamp: false
bounding_box: false
crop: true
height: 500
retain:
default: 5
mqtt:
timestamp: False
bounding_box: False
crop: True
height: 500
quality: 100
garage_south_west: # <------ Name the camera
ffmpeg:
inputs:
- path: rtsp://admin:******@10.0.1.22:554/12 # <----- Update for your camera
roles:
- detect
- path: rtsp://admin:******@10.0.1.22:554/11 # <----- Update for your camera
roles:
- record
rtmp:
enabled: False # <-- RTMP should be disabled if your stream is not H264
detect:
width: 1920 # <---- update for your camera's resolution
height: 1080 # <---- update for your camera's resolution
fps: 5
objects:
track:
- person
- dog
filters:
person:
threshold: 0.6
min_score: 0.75
dog:
threshold: 0.5
min_score: 0.7
motion:
mask:
- 430,498,592,475,542,317,470,295
- 952,478,832,467,845,317,907,340
- 0,233,593,157,1440,220,1760,385,1543,1080,1920,1080,1920,0,0,0
record:
enabled: True
retain:
days: 2
mode: all
events:
retain:
default: 5
mode: motion
pre_capture: 3
post_capture: 15
snapshots:
enabled: true
timestamp: false
bounding_box: false
crop: true
height: 500
retain:
default: 5
mqtt:
timestamp: False
bounding_box: False
crop: True
height: 500
quality: 100
east: # <------ Name the camera
ffmpeg:
inputs:
- path: rtsp://admin:******@10.0.1.54:554/12 # <----- Update for your camera
roles:
- detect
- path: rtsp://admin:******@10.0.1.54:554/11 # <----- Update for your camera
roles:
- record
# - rtmp
rtmp:
enabled: false # <-- RTMP should be disabled if your stream is not H264
detect:
width: 1920 # <---- update for your camera's resolution
height: 1080 # <---- update for your camera's resolution
fps: 5
objects:
track:
- person
- dog
filters:
person:
threshold: 0.5
min_score: 0.75
dog:
threshold: 0.5
min_score: 0.7
motion:
mask:
- 1920,210,1920,0,833,0,833,35
# threshold: 15
# zones:
record:
enabled: True
retain:
days: 2
mode: all
events:
retain:
default: 5
mode: motion
pre_capture: 3
post_capture: 15
snapshots:
enabled: true
timestamp: false
bounding_box: false
crop: true
height: 500
retain:
default: 5
mqtt:
timestamp: False
bounding_box: False
crop: True
height: 500
quality: 100
east_terrace: # <------ Name the camera
ffmpeg:
inputs:
- path: rtsp://admin:******@10.0.1.108:554/12 # <----- Update for your camera
roles:
- detect
- path: rtsp://admin:******@10.0.1.108:554/11 # <----- Update for your camera
roles:
- record
rtmp:
enabled: False # <-- RTMP should be disabled if your stream is not H264
detect:
width: 1920 # <---- update for your camera's resolution
height: 1080 # <---- update for your camera's resolution
fps: 5
objects:
track:
- person
- dog
filters:
person:
threshold: 0.5
min_score: 0.75
dog:
threshold: 0.5
min_score: 0.7
motion:
mask:
- 0,478,0,0,441,0,1920,0,1920,387,793,472
# threshold: 15
record:
enabled: True
retain:
days: 2
mode: all
events:
retain:
default: 5
mode: motion
pre_capture: 3
post_capture: 15
snapshots:
enabled: true
timestamp: false
bounding_box: false
crop: true
height: 500
retain:
default: 5
mqtt:
timestamp: False
bounding_box: False
crop: True
height: 500
quality: 100
# courtyard: # <------ Name the camera
# ffmpeg:
# inputs:
# - path: rtsp://admin:******@10.0.1.51:554/12 # <----- Update for your camera
# roles:
# - detect
# - path: rtsp://admin:******@10.0.1.51:554/11 # <----- Update for your camera
# roles:
# - record
# rtmp:
# enabled: False # <-- RTMP should be disabled if your stream is not H264
# detect:
# width: 1920 # <---- update for your camera's resolution
# height: 1080 # <---- update for your camera's resolution
# fps: 5
# # objects:
# # track:
# # - person
# # - car
# # filters:
# # person:
# # threshold: 0.8
# # min_score: 0.75
# # car:
# # # threshold: 0.5
# # min_score: 0.3
# # motion:
# # mask:
# # - 0,129,640,141,640,0,0,0
# # - 0,352,562,352,640,350,640,200,319,205,0,205
# # threshold: 15
# # zones:
# # # approaching:
# # # coordinates: 0,170,237,165,239,143,0,136
# # driving:
# # coordinates: 0,184,0,136,623,141,638,144,637,186
# # # leaving:
# # # coordinates: 432,166,576,170,575,148,435,141
# record:
# enabled: True
# retain:
# days: 2
# mode: all
# events:
# retain:
# default: 5
# mode: motion
# pre_capture: 3
# post_capture: 15
# snapshots:
# enabled: true
# timestamp: false
# bounding_box: false
# crop: true
# height: 500
# retain:
# default: 5
# mqtt:
# timestamp: False
# bounding_box: False
# crop: True
# height: 500
# quality: 100
greenhouse: # <------ Name the camera
ffmpeg:
inputs:
- path: rtsp://admin:******@10.0.1.140:554/12 # <----- Update for your camera
roles:
- detect
- path: rtsp://admin:******@10.0.1.140:554/11 # <----- Update for your camera
roles:
- record
rtmp:
enabled: False # <-- RTMP should be disabled if your stream is not H264
detect:
width: 1920 # <---- update for your camera's resolution
height: 1080 # <---- update for your camera's resolution
fps: 5
# objects:
# track:
# - person
# - car
# filters:
# person:
# threshold: 0.8
# min_score: 0.75
# car:
# # threshold: 0.5
# min_score: 0.3
# motion:
# mask:
# - 0,129,640,141,640,0,0,0
# - 0,352,562,352,640,350,640,200,319,205,0,205
# threshold: 15
# zones:
# # approaching:
# # coordinates: 0,170,237,165,239,143,0,136
# driving:
# coordinates: 0,184,0,136,623,141,638,144,637,186
# # leaving:
# # coordinates: 432,166,576,170,575,148,435,141
record:
enabled: True
retain:
days: 2
mode: all
events:
retain:
default: 5
mode: motion
pre_capture: 3
post_capture: 15
snapshots:
enabled: true
timestamp: false
bounding_box: false
crop: true
height: 500
retain:
default: 5
mqtt:
timestamp: False
bounding_box: False
crop: True
height: 500
quality: 100
Relevant log output
N/A
Frigate stats
No response
Operating system
HassOS
Install method
HassOS Addon
Coral version
USB
Any other information that may be helpful
No response
I would start by trying the QuickSync configuration. Ffprobe output or some info on your camera streams would be helpful to know.
Thanks for the reply.
There are two Quicksync options:
ffmpeg: hwaccel_args: - -hwaccel - qsv - -qsv_device - /dev/dri/renderD128
ffmpeg: hwaccel_args: - -hwaccel - vaapi - -hwaccel_device - /dev/dri/renderD128 - -hwaccel_output_format - yuv420p
Which do you suggest? How will I know if I have the correct one?
I'll need some help with Ffprobe output. What is that? What camera streams info do you need?
Which do you suggest?
Per the docs I believe your CPU is older than 10th gen so this should be preferred
ffmpeg:
hwaccel_args:
- -hwaccel
- vaapi
- -hwaccel_device
- /dev/dri/renderD128
- -hwaccel_output_format
- yuv420p
How will I know if I have the correct one?
You should be able to use intel_gpu_top
to see if it's being utilized
I'll need some help with Ffprobe output. What is that? What camera streams info do you need?
Ffprobe is a tool built into ffmpeg to get information about a media source and will print a big summary. You should be able to run it like ffprobe rtsp://admin:******@10.0.1.42:554/12
Do I run these in the HA terminal?
I just get "Command not found"
Is the hwaccel_args: set on a per camera basis?
Do I run these in the HA terminal?
I just get "Command not found"
I thought it might, in that case you'll likely need to run from inside the frigate container.
I think you should be able to do this with docker exec -it frigate ffprobe
frigate may need to change depending on the version of the addon you have installed
Is the hwaccel_args: set on a per camera basis?
It can be set globally and overridden at the camera level. I'd try globally first and see if any have issues.
Thank you.
It's saying frigate container doesn't exist.
Run docker container ls
to see the options and then use the name for frigate in the previous command
This is the only reference I can find to frigate :ccab4aaf/amd64-addon-frigate-fa:3.1
Trying docker exec -it frigate-fa ffprobe
again gives no container found.
Probably need to do docker exec -it ccab4aaf/amd64-addon-frigate-fa ffprobe
I get 'no such container' again.
I should be doing this in the HA terminal, right?
Yeah, I haven't tried this through HA so it may not work like a normal system. I'll have to see if there's another recommended way
I have similar "problems" with my Dell-OptiPlex-3040M-DM-i3-6100T-8-120SSD.
Try docker exec -it addon_ccab4aaf_frigate-fa ffprobe
That gave some info for me..
ffprobe version 4.3.1 Copyright (c) 2007-2020 the FFmpeg developers built with gcc 9 (Ubuntu 9.3.0-17ubuntu1~20.04) configuration: --disable-debug --disable-doc --disable-ffplay --enable-shared --enable-avresample --enable-libopencore-amrnb --enable-libopencore-amrwb --enable-gpl --enable-libfreetype --enable-libvidstab --enable-libmfx --enable-libmp3lame --enable-libopus --enable-libtheora --enable-libvorbis --enable-libvpx --enable-libwebp --enable-libxcb --enable-libx265 --enable-libxvid --enable-libx264 --enable-nonfree --enable-openssl --enable-libfdk_aac --enable-postproc --enable-small --enable-version3 --enable-libzmq --extra-libs=-ldl --prefix=/opt/ffmpeg --enable-libopenjpeg --enable-libkvazaar --enable-libaom --extra-libs=-lpthread --enable-vaapi --extra-cflags=-I/opt/ffmpeg/include --extra-ldflags=-L/opt/ffmpeg/lib libavutil 56. 51.100 / 56. 51.100 libavcodec 58. 91.100 / 58. 91.100 libavformat 58. 45.100 / 58. 45.100 libavdevice 58. 10.100 / 58. 10.100 libavfilter 7. 85.100 / 7. 85.100 libavresample 4. 0. 0 / 4. 0. 0 libswscale 5. 7.100 / 5. 7.100 libswresample 3. 7.100 / 3. 7.100 libpostproc 55. 7.100 / 55. 7.100 Simple multimedia streams analyzer usage: ffprobe [OPTIONS] [INPUT_FILE]
Thank you for that.
I got:
configuration: --disable-debug --disable-doc --disable-ffplay --enable-shared --enable-avresample --enable-libopencore-amrnb --enable-libopencore-amrwb --enable-gpl --enable-libfreetype --enable-libvidstab --enable-libmfx --enable-libmp3lame --enable-libopus --enable-libtheora --enable-libvorbis --enable-libvpx --enable-libwebp --enable-libxcb --enable-libx265 --enable-libxvid --enable-libx264 --enable-nonfree --enable-openssl --enable-libfdk_aac --enable-postproc --enable-small --enable-version3 --enable-libzmq --extra-libs=-ldl --prefix=/opt/ffmpeg --enable-libopenjpeg --enable-libkvazaar --enable-libaom --extra-libs=-lpthread --enable-vaapi --extra-cflags=-I/opt/ffmpeg/include --extra-ldflags=-L/opt/ffmpeg/lib libavutil 56. 51.100 / 56. 51.100 libavcodec 58. 91.100 / 58. 91.100 libavformat 58. 45.100 / 58. 45.100 libavdevice 58. 10.100 / 58. 10.100 libavfilter 7. 85.100 / 7. 85.100 libavresample 4. 0. 0 / 4. 0. 0 libswscale 5. 7.100 / 5. 7.100 libswresample 3. 7.100 / 3. 7.100 libpostproc 55. 7.100 / 55. 7.100
Unfortunately, I have little to no idea what any of that means.
What hardware acceleration settings did you settle on?
I think that both vaapi and qsv are available.
Run docker exec -it addon_ccab4aaf_frigate-fa ffmpeg -hwaccels
Which gave for me:
Hardware acceleration methods:
vaapi
qsv
But I still don't know which one is better. I have tried both without any difference. Although I see no difference if I disable hwaccel completely.
I get the same result.
Please can you share what you put in your config so that I can give both options a try?
I'm currently at almost 60% CPU use for Frigate.
You can find both in the docs. But here are both which I have tried.
hwaccel_args:
- -hwaccel
- vaapi
- -hwaccel_device
- /dev/dri/renderD128
- -hwaccel_output_format
- yuv420p
hwaccel_args:
- -hwaccel
- qsv
- -qsv_device
- /dev/dri/renderD128
Both of those increased my CPU usage!
Is there a way to create a Frigate CPU usage sensor in Home Assistant so that I can track usage and maybe correlate it to camera motion activity?
Is there a way to create a Frigate CPU usage sensor in Home Assistant so that I can track usage and maybe correlate it to camera motion activity?
Not CPU usage.
In the 0.11 beta there is a different build of ffmpeg which seems to better support hwaccel and supports multiple drivers that may work better in your case
Great! When will it be out of beta?
Great! When will it be out of beta?
There's not really a straightforward answer, still ironing out a couple small bugs, once it seems totally stable it'll go to RC, then full release sometime after.
This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.
I get a more extensive list of options but like you, unsure which one to use on my Dell 3050 USFF
docker exec -it addon_ccab4aaf_frigate-fa-beta ffmpeg -hwaccels
ffmpeg version n5.1-2-g915ef932a3-20220731 Copyright (c) 2000-2022 the FFmpeg developers
built with gcc 12.1.0 (crosstool-NG 1.25.0.55_3defb7b)
configuration: --prefix=/ffbuild/prefix --pkg-config-flags=--static --pkg-config=pkg-config --cross-prefix=x86_64-ffbuild-linux-gnu- --arch=x86_64 --target-os=linux --enable-gpl --enable-version3 --disable-debug --enable-iconv --enable-libxml2 --enable-zlib --enable-libfreetype --enable-libfribidi --enable-gmp --enable-lzma --enable-fontconfig --enable-libvorbis --enable-opencl --enable-libpulse --enable-libvmaf --enable-libxcb --enable-xlib --enable-amf --enable-libaom --enable-libaribb24 --enable-avisynth --enable-libdav1d --enable-libdavs2 --disable-libfdk-aac --enable-ffnvcodec --enable-cuda-llvm --enable-frei0r --enable-libgme --enable-libass --enable-libbluray --enable-libjxl --enable-libmp3lame --enable-libopus --enable-mbedtls --enable-librist --enable-libtheora --enable-libvpx --enable-libwebp --enable-lv2 --enable-libmfx --enable-libopencore-amrnb --enable-libopencore-amrwb --enable-libopenh264 --enable-libopenjpeg --enable-libopenmpt --enable-librav1e --enable-librubberband --disable-schannel --enable-sdl2 --enable-libsoxr --enable-libsrt --enable-libsvtav1 --enable-libtwolame --enable-libuavs3d --enable-libdrm --enable-vaapi --enable-libvidstab --enable-vulkan --enable-libshaderc --enable-libplacebo --enable-libx264 --enable-libx265 --enable-libxavs2 --enable-libxvid --enable-libzimg --enable-libzvbi --extra-cflags=-DLIBTWOLAME_STATIC --extra-cxxflags= --extra-ldflags=-pthread --extra-ldexeflags=-pie --extra-libs='-ldl -lgomp' --extra-version=20220731
libavutil 57. 28.100 / 57. 28.100
libavcodec 59. 37.100 / 59. 37.100
libavformat 59. 27.100 / 59. 27.100
libavdevice 59. 7.100 / 59. 7.100
libavfilter 8. 44.100 / 8. 44.100
libswscale 6. 7.100 / 6. 7.100
libswresample 4. 7.100 / 4. 7.100
libpostproc 56. 6.100 / 56. 6.100
Hardware acceleration methods:
cuda
vaapi
qsv
drm
opencl
vulkan