Frigate NVR Configuration

Frigate NVR Configuration

Please read Liability Disclaimer and License Agreement CAREFULLY

Frigate NVR configuration file - Sends data to MQTT from Hikvision DS-2CD2463G0-I Camera

frigate.yml

# https://docs.frigate.video/configuration/index#full-configuration-reference

mqtt:
  host: Your_MQTT_Server_IP
  user: Your_MQTT_Server_UserName
  password: Your_MQTT_Server_Password
  topic_prefix: zigbee2mqtt
  client_id: zigbee2mqtt

detectors:
  # Required: name of the detector
  coral:
    # Required: type of the detector
    # Valid values are 'edgetpu' (requires device property below) and 'cpu'.
    type: edgetpu
    # Optional: device name as defined here: https://coral.ai/docs/edgetpu/multiple-edgetpu/#using-the-tensorflow-lite-python-api
    device: pci
    
database:
  # The path to store the SQLite DB (default: shown below)
  path: /media/frigate/frigate.db
  
# Optional: model modifications
model:
  # Optional: path to the model (default: automatic based on detector)
  path: /edgetpu_model.tflite
  # Optional: path to the labelmap (default: shown below)
  labelmap_path: /labelmap.txt
  # Required: Object detection model input width (default: shown below)
  width: 320
  # Required: Object detection model input height (default: shown below)
  height: 320
  # Optional: Label name modifications. These are merged into the standard labelmap.
  labelmap:
    2: vehicle
    
# Optional: birdseye configuration
birdseye:
  # Optional: Enable birdseye view (default: shown below)
  enabled: True
  # Optional: Width of the output resolution (default: shown below)
  width: 1280
  # Optional: Height of the output resolution (default: shown below)
  height: 720
  # Optional: Encoding quality of the mpeg1 feed (default: shown below)
  # 1 is the highest quality, and 31 is the lowest. Lower quality feeds utilize less CPU resources.
  quality: 8
  # Optional: Mode of the view. Available options are: objects, motion, and continuous
  #   objects - cameras are included if they have had a tracked object within the last 30 seconds
  #   motion - cameras are included if motion was detected in the last 30 seconds
  #   continuous - all cameras are included always
  mode: objects

# Optional: ffmpeg configuration
ffmpeg:
  # Optional: global ffmpeg args (default: shown below)
  global_args: -hide_banner -loglevel warning
  # Optional: global hwaccel args (default: shown below)
  # NOTE: See hardware acceleration docs for your specific device
  hwaccel_args: []
  # Optional: global input args (default: shown below)
  input_args: -avoid_negative_ts make_zero -fflags +genpts+discardcorrupt -rtsp_transport tcp -stimeout 5000000 -use_wallclock_as_timestamps 1
  # Optional: global output args
  output_args:
    # Optional: output args for detect streams (default: shown below)
    detect: -f rawvideo -pix_fmt yuv420p
    # Optional: output args for record streams (default: shown below)
    record: -f segment -segment_time 10 -segment_format mp4 -reset_timestamps 1 -strftime 1 -c copy -an
    # Optional: output args for rtmp streams (default: shown below)
    rtmp: -c copy -f flv

detect: 
  # Width of the frame for the input with the detect role       
  width: 3072
  # Height of the frame for the input with the detect role
  height: 1728
  # Desired fps for your camera for the input with the detect role
  fps: 5
  # Number of frames without a detection before frigate considers an object to be gone.
  max_disappeared: 25

objects:
  # Optional: list of objects to track from labelmap.txt
  track:
    - person
  # Filters to reduce false positives for specific object types
  filters:
    person:
      # Minimum width*height of the bounding box for the detected object
      min_area: 10000
      # Maximum width*height of the bounding box for the detected object
      max_area: 1000000
      # Minimum decimal percentage for tracked object's computed score to be considered a true positive
      threshold: 0.7

motion:
  # Optional: The threshold passed to cv2.threshold to determine if a pixel is different enough to be counted as motion. (default: shown below)
  # Increasing this value will make motion detection less sensitive and decreasing it will make motion detection more sensitive.
  # The value should be between 1 and 255.
  threshold: 25
  # Optional: Minimum size in pixels in the resized motion image that counts as motion (default: 30)
  # Increasing this value will prevent smaller areas of motion from being detected. Decreasing will
  # make motion detection more sensitive to smaller moving objects.
  # As a rule of thumb:
  #  - 15 - high sensitivity
  #  - 30 - medium sensitivity
  #  - 50 - low sensitivity
  contour_area: 30
  # Optional: Alpha value passed to cv2.accumulateWeighted when averaging the motion delta across multiple frames (default: shown below)
  # Higher values mean the current frame impacts the delta a lot, and a single raindrop may register as motion.
  # Too low and a fast moving person wont be detected as motion.
  delta_alpha: 0.2
  # Optional: Alpha value passed to cv2.accumulateWeighted when averaging frames to determine the background (default: shown below)
  # Higher values mean the current frame impacts the average a lot, and a new object will be averaged into the background faster.
  # Low values will cause things like moving shadows to be detected as motion for longer.
  # https://www.geeksforgeeks.org/background-subtraction-in-an-image-using-concept-of-running-average/
  frame_alpha: 0.2
  # Optional: Height of the resized motion frame  (default: 50)
  # This operates as an efficient blur alternative. Higher values will result in more granular motion detection at the expense
  # of higher CPU usage. Lower values result in less CPU, but small changes may not register as motion.
  frame_height: 50
  # Optional: improve contrast (default: shown below)
  # Enables dynamic contrast improvement. This should help improve night detections at the cost of making motion detection more sensitive
  # for daytime.
  improve_contrast: False

record:
  enabled: True
  # Number of minutes to wait between cleanup runs - one week
  expire_interval: 10080
  # Number of days to retain recordings regardless of events
  retain:
    days: 2
    mode: all
        
snapshots:
  # Enable writing jpg snapshot to /media/frigate/clips
  enabled: True
  # Print a timestamp on the snapshots
  timestamp: True
  # Draw bounding box on the snapshots
  bounding_box: True
  retain:
    # Retention days
    default: 10

cameras:
  DS-2CD2463G0-I:
    ffmpeg:
      hwaccel_args:
        - -c:v
        - h264_cuvid
      #Low resolution stream   
      inputs:
        - path: rtsp://CameraUserName:UserPassword@Camera_IP_Address:Camera_Port/Steaming/Channels/102
          roles:
            - rtmp
            - detect
      #High resolution stream      
      inputs:
        - path: rtsp://CameraUserName:UserPassword@Camera_IP_Address:Camera_Port/Steaming/Channels/101
          roles:
            - record

Comments powered by CComment