r/frigate_nvr • • 7d ago

Help with optimizing my setup

Not sure if this kind of post is OK here, if not I've got no issue with it being taken down.

Hi everyone, I have my frigate set up with 3 different cameras with person detection on all 3 and some masks and zones set up. I've got a coral edge m.2 accelerator on the machine that hosts the frigate instance. I've just gotten it set up not too long ago and have been monitoring it's performance. A few times a minute usually, I get a warning saying one of the cameras is using higher than normal CPU (30%+). This wouldn't be an issue as it usually only lasts for a second or so, but any time this happens the feed that Home Assistant is receiving and displaying cuts out until it returns to under 30%, sort of defeating the purpose of having it tied into HA. I also notice that even though I have masks enabled, I still get a ton of recordings of things inside the mask zones.

Since I'm pretty new to frigate, I was hoping I could post my setup here and statistics and get some advice on how to improve. Overall, my setup is a Beelink s12 with the coral edge m.2 installed (I know it's out of support, I can't update it but it still works until I can find a replacement). Proxmox hosts Home Assistant and Frigate. Frigate has been allocated 3 CPU cores (of 4 total) and 6GB memory (of 16). Both of these stay pretty consistently under 30% usage.

My config is below. I got the settings offline from the forums or YouTube for setup, so I've got no idea if it's actually optimal. I mostly want to avoid things that may cause issues or the spikes in usage without knowing it. Any advice is welcome

mqtt:
  host: IP # <---- same mqtt broker that home assistant uses
  user: username
  password: password

auth:
  session_length: 60

ffmpeg:
  hwaccel_args: preset-vaapi

detectors:
  coral:
    type: edgetpu
    device: pci

model:
  width: 320
  height: 320
  input_tensor: nhwc
  input_pixel_format: rgb
  input_dtype: int
  path: /edgetpu_model.tflite

record:
  enabled: true
  motion:
    days: 7
  alerts:
    retain:
      days: 5
      mode: motion

detect:
  fps: 5
  enabled: true
objects:
  track:
    - person
    - umbrella

snapshots:
  enabled: true
  retain:
    default: 15

cameras:
  reolink_doorbell_front:
    ffmpeg:
      inputs:
        - path: rtsp://username:password@cameraip
          roles:
            - detect
            - record

    motion:
      enabled: true
      mask:
        - 0.024,0.665,0.051,0.82,0.101,0.971,0.252,0.884,0.234,0.737,0.14,0.645
        - 0.329,0.699,0.522,0.713,0.52,0.657,0.456,0.63,0.384,0.626,0.332,0.644
        - 0.71,0.676,0.66,0.634,0.698,0.572,0.752,0.625
        - 0.829,0.644,0.898,0.641,0.902,0.545,0.871,0.526,0.833,0.552
        - 0.998,0.569,0.829,0.553,0.792,0.334,0.72,0.283,0.653,0.052,0.887,0.054,0.925,0.121,0.998,0.102
        - 0.78,0.467,0.322,0.466,0.345,0.402,0.208,0.286,0.061,0.218,0.083,0.152,0.139,0.11,0.258,0.117,0.395,0.149,0.405,0.086,0.654,0.054,0.722,0.281,0.79,0.334,0.809,0.453
        - 0.629,0.543,0.608,0.574,0.714,0.573,0.673,0.542
        - 0.316,0.563,0.58,0.572,0.606,0.577,0.62,0.547,0.567,0.56,0.317,0.553
        - 0.708,0.564,0.995,0.569,0.713,0.577
        - 0.319,0,0.318,0.042,0.66,0.042,0.659,0
    zones:
      frontpath:
        coordinates: 
          0.106,0.974,0.253,0.878,0.363,0.943,0.552,0.702,0.523,0.7,0.523,0.652,0.474,0.634,0.503,0.621,0.641,0.628,0.57,0.996,0.115,0.997
        loitering_time: 0
        friendly_name: FrontPath
        objects:
          - person
          - umbrella
    review:
      alerts: {}
    objects:
      filters:
        person: {}
  amcrest_turret_back:
    ffmpeg:
      inputs:
        - path: rtsp://username:password@cameraip/
          roles:
            - detect
            - record

    motion:
      enabled: true

      mask:
        - -0.001,0.526,0.535,0.346,0.536,0.007,0.001,0.002
        - 0.583,0.341,0.685,0.284,0.99,0.403,0.994,0.268,0.542,0.007,0.54,0.332
    zones:
      deck:
        coordinates: 
          0.001,0.54,0.553,0.339,0.827,0.445,0.844,0.519,0.826,0.588,0.932,0.656,0.994,0.446,0.997,0.997,0.001,0.997
        loitering_time: 0
        objects:
          - person
          - umbrella
        friendly_name: Deck
        inertia: 3
      yard:
        coordinates: 
          0.595,0.346,0.687,0.287,0.988,0.408,0.929,0.647,0.835,0.581,0.853,0.514,0.835,0.438
        loitering_time: 0
        objects:
          - person
          - umbrella
        friendly_name: Yard
  amcrest_turret_garage:
    ffmpeg:
      inputs:
        - path: rtsp://username:password@cameraip/
          roles:
            - detect

    motion:
      mask:
        - 0.211,0.429,0.276,0.413,0.418,0.307,0.437,0.144,0.272,0.001,0,0,-0.001,0.513,0.134,0.426
        - 0.344,0.36,0.468,0.345,0.724,0.314,0.998,0.315,0.998,0.301,0.845,0.291,0.704,0.296,0.687,0.208,0.43,0.214,0.417,0.305,0.383,0.332
        - 0.273,0,0.438,0.144,0.43,0.218,0.844,0.203,0.998,0.234,1,0
        - 0,1,0.054,0.753,0.311,0.743,0.477,0.927,0.66,0.916,0.777,1,0.194,1
    zones:
      driveway:
        coordinates: 0.777,1,0.662,0.916,0.47,0.344,0.728,0.315,0.998,0.528,1,1
        loitering_time: 0
        friendly_name: Driveway
        objects:
          - person
          - umbrella
version: 0.17-0
camera_groups:
  Front_Yard:
    order: 1
    icon: LuHouse
    cameras:
      - reolink_doorbell_front
      - amcrest_turret_garage
3 Upvotes

5 comments sorted by

3

u/hawkeye217 Developer 7d ago

What is the resolution of your cameras?

If it's high, you will want to use a lower resolution substream for detection.

https://docs.frigate.video/frigate/camera_setup/#choosing-a-detect-resolution

https://docs.frigate.video/configuration/cameras/#setting-up-camera-inputs

You'll also want to make sure hardware acceleration is working correctly.

https://docs.frigate.video/configuration/hardware_acceleration_video/

1

u/Beaufort_The_Cat 7d ago

Thanks for the links! I’ll check them out.
The resolution for the cameras is at 720, they can go up to 1080 each but I haven’t messed around with the different substreams yet, maybe that’s what I’ll do and see how it effects usage

6

u/hawkeye217 Developer 7d ago

Feel free to use the free AI chat at https://docs.frigate.video (the "Ask AI" button at the bottom). It's trained on the official docs and can walk you through getting things optimized.

2

u/Particular_Ferret747 7d ago

Maybe u want to consider go2rtc for fmpeg manipulations orand faster image

1

u/Madh2orat 5d ago

I may get downvoted for this, but AI has been good to me with helping identify optimizations for my config.