# Frigate NVR — chelsty-infra
# Hardware decode: Intel UHD 630 via VAAPI (/dev/dri/renderD128)
# Object detection: CPU (no Coral TPU)
# Cameras: 2x Reolink RLC-540 (5MP, WiFi)
#
# Required env vars in /opt/homelab/config/frigate/frigate.env:
#   CAMERA1_IP, CAMERA1_USER, CAMERA1_PASS
#   CAMERA2_IP, CAMERA2_USER, CAMERA2_PASS
#   MQTT_USER, MQTT_PASS  (if mosquitto auth is enabled)

mqtt:
  enabled: true
  host: 127.0.0.1
  port: 1883
  # user: "{MQTT_USER}"
  # password: "{MQTT_PASS}"

detectors:
  cpu1:
    type: cpu
    num_threads: 3

ffmpeg:
  hwaccel_args: preset-vaapi
  global_args:
    - -hide_banner
    - -loglevel
    - warning

record:
  enabled: true
  retain:
    days: 7
    mode: all
  events:
    retain:
      default: 14
      mode: motion

snapshots:
  enabled: true
  retain:
    default: 7
  quality: 70

objects:
  track:
    - person
    - car
    - bicycle
  filters:
    person:
      min_area: 5000
      max_area: 100000
      threshold: 0.7

cameras:
  camera1:
    ffmpeg:
      inputs:
        # Main stream — high-res recording
        - path: rtsp://{CAMERA1_USER}:{CAMERA1_PASS}@{CAMERA1_IP}:554/h264Preview_01_main
          roles:
            - record
        # Sub stream — low-res detection (lower CPU cost)
        - path: rtsp://{CAMERA1_USER}:{CAMERA1_PASS}@{CAMERA1_IP}:554/h264Preview_01_sub
          roles:
            - detect
    detect:
      enabled: true
      width: 640
      height: 480
      fps: 5

  camera2:
    ffmpeg:
      inputs:
        - path: rtsp://{CAMERA2_USER}:{CAMERA2_PASS}@{CAMERA2_IP}:554/h264Preview_01_main
          roles:
            - record
        - path: rtsp://{CAMERA2_USER}:{CAMERA2_PASS}@{CAMERA2_IP}:554/h264Preview_01_sub
          roles:
            - detect
    detect:
      enabled: true
      width: 640
      height: 480
      fps: 5
