blakeblackshear / frigate

NVR with realtime local object detection for IP cameras
https://frigate.video
MIT License
19.48k stars 1.8k forks source link

Specify different record config for alerts and detections #13365

Closed shinyzard123 closed 2 months ago

shinyzard123 commented 3 months ago

Describe what you are trying to accomplish and why in non technical terms

Right now events is still used in the recording config but it is not clear what is an event vs an alert or detection.

Describe the solution you'd like

I think it would be more intuitive to have separate configs for alerts and detections. In most cases you would probably want to retain recordings for different amounts of time for a person in a zone vs general

Describe alternatives you've considered

I think we can delete the review items in the UI, so detections could be deleted. But that is a lot of effort

NickM-27 commented 3 months ago

The recording retention config wasn't changed because we did not want to introduce more breaking changes / new configurations to learn in one release. I have a PR up for this to be simplified in 0.15

jjavin commented 2 months ago

Hi, with PR the alerts disappear after 1 hour. Is this normal?

NickM-27 commented 2 months ago

I'm not seeing this behavior, more details are needed

jjavin commented 2 months ago

The only thing I see in the logs, which I swear I didn't see before, is:

Info 2024-09-02 22:51:01 frigate.record.cleanup the list is [] Info 2024-09-02 22:51:01 frigate.record.cleanup the list is ['1725308122.640608-88mml7', '1725308126.590158-hdfepa', '1725308163.251758-b7rvyr', '1725308563.821566-imwwy0', '1725308566.79712-16bkni', '1725309236.188011-mgdjz4', '1725309342.889967-pq50g4', '1725309342.937792-0uv4hx', '1725309392.420663-d1o4of', '1725309434.51911-f5bwuq'] Info 2024-09-02 22:51:02 frigate.record.cleanup the list is [] Info 2024-09-02 23:51:03 frigate.record.cleanup the list is [] Info 2024-09-02 23:51:04 frigate.record.cleanup the list is [] Info 2024-09-02 23:51:04 frigate.record.cleanup the list is [] Info 2024-09-02 23:51:04 frigate.record.cleanup the list is [] Info 2024-09-02 23:51:04 frigate.record.cleanup the list is [] Info 2024-09-02 23:51:04 frigate.record.cleanup the list is [] Info 2024-09-02 23:51:05 frigate.record.cleanup the list is [] Info 2024-09-03 00:51:06 frigate.record.cleanup the list is [] Info 2024-09-03 00:51:07 frigate.record.cleanup the list is [] Info 2024-09-03 00:51:08 frigate.record.cleanup the list is [] Info 2024-09-03 00:51:08 frigate.record.cleanup the list is ['1725313908.524145-kzs8po', '1725314033.862279-p27348', '1725314105.697731-ewbotr', '1725314433.869446-kvk6h3', '1725314479.203339-sug2bs', '1725314537.756359-cnjc10', '1725314643.734062-utj0ve', '1725314678.868145-pg8g1n', '1725314724.501597-jald23', '1725314848.459352-vd846h', '1725317090.484893-z8i8ua'] Info 2024-09-03 00:51:08 frigate.record.cleanup

NickM-27 commented 2 months ago

oh oops, that shouldn't be there. What is your config?

jjavin commented 2 months ago

Hello, this is my config:

`mqtt:
  host: 192.168.0.**
  port: 1883
  topic_prefix: frigate
  client_id: frigate
  user: ******
  password: ******
  stats_interval: 15 
ffmpeg:
  hwaccel_args: preset-vaapi
  output_args:
    record: preset-record-generic-audio-aac

##############################
go2rtc:
  streams:
    Pozo_H:
      - rtsp://******:******@192.168.2.126:554/h264Preview_01_main
      - ffmpeg:Pozo_H#audio=aac

    Pozo_L:
      - rtsp://******:******@192.168.2.126:554/h264Preview_01_sub
      - ffmpeg:Pozo_L#audio=aac
    Jacuzzi_H:
      - rtsp://******:******@192.168.2.119:554/h264Preview_01_main
      - ffmpeg:Jacuzzi_H#audio=aac#video=h264#hardware

    Jacuzzi_L:
      - rtsp://******:******@192.168.2.119:554/Preview_01_sub
      - ffmpeg:Jacuzzi_L#audio=aac
    Puerta_H:
      - rtsp://******:******@192.168.2.131:554/Preview_01_main
      - ffmpeg:Puerta_H#audio=aac#video=h264#hardware

    Puerta_L:
      - rtsp://******:******@192.168.2.131:554/h264Preview_01_sub
      - ffmpeg:Puerta_L#audio=aac
    Rocalla_H:
      - rtsp://******:******@192.168.2.77:554/Preview_01_main
      - ffmpeg:Rocalla_H#audio=aac

    Rocalla_L:
      - rtsp://******:******@192.168.2.77:554/h264Preview_01_sub
      - ffmpeg:Rocalla_L#audio=aac
    Portero_H:
      - rtsp://******:******@192.168.2.137:554/h264Preview_01_main
      - ffmpeg:Portero_H#audio=aac#audio=copy#audio=opus

    Portero_L:
      - rtsp://******:******@192.168.2.137:554/h264Preview_01_sub
      - ffmpeg:Portero_L#audio=aac
    Garaje_H:
      - rtsp://******:******@192.168.2.100:554/h264Preview_01_main
      - ffmpeg:Garaje_H#audio=aac

    Garaje_L:
      - rtsp://******:******@192.168.2.100:554/h264Preview_01_sub
      - ffmpeg:Garaje_L#audio=aac
    Interior_H:
      - rtsp://******:******@192.168.2.97:554/h264Preview_01_main
      - ffmpeg:Interior_H#audio=aac

    Interior_L:
      - rtsp://******:******@192.168.2.97:554/h264Preview_01_sub
      - ffmpeg:Interior_L#audio=aac
  webrtc:
    candidates:
      - 192.168.0.*:8555
      - stun:8555

detectors:
  coral:
    type: edgetpu
    device: usb

model:
  path: plus://*****

birdseye:
  enabled: true
  mode: continuous
  restream: true

cameras:

  Pozo:
    birdseye:
      order: 1
    ffmpeg:
      inputs:
        - path: rtsp://127.0.0.1:8554/Pozo_L?video=copy&audio=aac
          input_args: preset-rtsp-restream
          roles:
            - record
        - path: rtsp://127.0.0.1:8554/Pozo_L?video=copy
          input_args: preset-rtsp-restream
          roles:
            - detect
    live:
      stream_name: Pozo_L
    detect:
      fps: 5
      enabled: true # <---- disable detection until you have a working camera feed
      width: 1536 # <---- update for your camera's resolution
      height: 576
    motion:
      threshold: 30
      contour_area: 10
      frame_height: 150
      mask:
        - 1536,290,1038,197,881,143,758,127,665,99,486,133,483,255,0,321,0,0,1536,0
    record:
      enabled: true
      retain:
        days: 10
        mode: all
      alerts:
        retain:
          days: 10
          mode: motion
    objects:
      track:
        - person
        - face
        - license_plate
        - dog
        - cat
        - car
        - amazon
        - fedex
        - ups
        - package
      filters:
        dog:
          min_score: .7
          threshold: .9
        cat:
          min_score: .7
          threshold: .9
        face:
          min_score: .7
        package:
          min_score: .65
          threshold: .9
        license_plate:
          min_score: .6
        amazon:
          min_score: .75
        ups:
          min_score: .75
        fedex:
          min_score: .75
        person:
          min_score: .7
          threshold: .75
          max_area: 60000
          max_ratio: 0.7
          min_area: 500
        car:
          min_score: 0.70
#         threshold: 0.8
          threshold: .85
          min_area: 4000
          max_area: 100000
          mask:
            - 0,576,0,270,497,164,675,127,878,177,1387,576
  Jacuzzi:
    birdseye:
      order: 4
    ffmpeg:
      inputs:
        - path: rtsp://127.0.0.1:8554/Jacuzzi_L?video=copy&audio=aac
          input_args: preset-rtsp-restream
          roles:
            - record
        - path: rtsp://127.0.0.1:8554/Jacuzzi_L?video=copy
          input_args: preset-rtsp-restream
          roles:
            - detect
    live:
      stream_name: Jacuzzi_L
    detect:
      fps: 5
      enabled: true # <---- disable detection until you have a working camera feed
      width: 1536 # <---- update for your camera's resolution
      height: 576
    motion:
      threshold: 30
      contour_area: 10
      frame_height: 150
      mask:
        - 0,0,0,304,280,281,345,269,457,41,321,193,842,152,916,187,1025,187,1536,31,1536,0,1536,0
    record:
      enabled: true
      retain:
        days: 10
        mode: all
      alerts:
        retain:
          days: 10
          mode: motion
    objects:
      track:
        - person
        - face
        - license_plate
        - dog
        - cat
        - car
        - amazon
        - fedex
        - ups
        - package
      filters:
        dog:
          min_score: .7
          threshold: .9
        cat:
          min_score: .7
          threshold: .9
        face:
          min_score: .7
        package:
          min_score: .65
          threshold: .9
        license_plate:
          min_score: .6
        amazon:
          min_score: .75
        ups:
          min_score: .75
        fedex:
          min_score: .75
        person:
          min_score: .7
          threshold: .75
          max_area: 60000
          max_ratio: 0.7
        car:
          min_score: 0.70
#         threshold: 0.8
          threshold: .85
          min_area: 4000
          max_area: 100000
          mask:
            - 0,576,0,270,497,164,675,127,878,177,1387,576
  Rocalla:
    birdseye:
      order: 1
    ffmpeg:
      inputs:
        - path: rtsp://127.0.0.1:8554/Rocalla_L?video=copy&audio=aac
          input_args: preset-rtsp-restream
          roles:
            - record
        - path: rtsp://127.0.0.1:8554/Rocalla_L?video=copy
          input_args: preset-rtsp-restream
          roles:
            - detect
    onvif:
      host: 192.168.*.**
      port: 8000
      user: ******
      password: ******
    live:
      stream_name: Rocalla_H
    detect:
      fps: 5
      enabled: true # <---- disable detection until you have a working camera feed
      width: 640 # <---- update for your camera's resolution
      height: 360
    motion:
      threshold: 30
      contour_area: 10
      frame_height: 150
    record:
      enabled: true
      retain:
        days: 10
        mode: all
      alerts:
        retain:
          days: 10
          mode: motion
    objects:
      track:
        - person
        - face
        - license_plate
        - dog
        - cat
        - car
        - amazon
        - fedex
        - ups
        - package
      filters:
        dog:
          min_score: .7
          threshold: .9
        cat:
          min_score: .7
          threshold: .9
        face:
          min_score: .7
        package:
          min_score: .65
          threshold: .9
        license_plate:
          min_score: .6
        amazon:
          min_score: .75
        ups:
          min_score: .75
        fedex:
          min_score: .75
        person:
          min_score: .7
          threshold: .75
          max_area: 60000
          max_ratio: 0.7
        car:
          min_score: 0.70
#         threshold: 0.8
          threshold: .85
          min_area: 4000
          max_area: 100000
  Garaje:
    birdseye:
      order: 4
    ffmpeg:
      inputs:
        - path: rtsp://127.0.0.1:8554/Garaje_L?video=copy&audio=aac
          input_args: preset-rtsp-restream
          roles:
            - record
        - path: rtsp://127.0.0.1:8554/Garaje_L?video=copy
          input_args: preset-rtsp-restream
          roles:
            - detect
    onvif:
      host: 192.168.*.*
      port: 8000
      user: ******
      password: ******
    live:
      stream_name: Garaje_H
    detect:
      fps: 5
      enabled: true # <---- disable detection until you have a working camera feed
      width: 640 # <---- update for your camera's resolution
      height: 480
    motion:
      threshold: 30
      contour_area: 10
      frame_height: 150
    record:
      enabled: true
      retain:
        days: 10
        mode: all
      alerts:
        retain:
          days: 10
          mode: motion
    objects:
      track:
        - person
        - face
        - license_plate
        - dog
        - cat
        - car
        - amazon
        - fedex
        - ups
        - package
      filters:
        dog:
          min_score: .7
          threshold: .9
        cat:
          min_score: .7
          threshold: .9
        face:
          min_score: .7
        package:
          min_score: .65
          threshold: .9
        license_plate:
          min_score: .6
        amazon:
          min_score: .75
        ups:
          min_score: .75
        fedex:
          min_score: .75
        person:
          min_score: .7
          threshold: .75
          max_area: 60000
          max_ratio: 0.7
        car:
          min_score: 0.70
#          threshold: 0.8
          threshold: .85
          min_area: 4000
          max_area: 100000
  Interior:
    birdseye:
      order: 4
    ffmpeg:
      inputs:
        - path: rtsp://127.0.0.1:8554/Interior_L?video=copy&audio=aac
          input_args: preset-rtsp-restream
          roles:
            - record
        - path: rtsp://127.0.0.1:8554/Interior_L?video=copy
          input_args: preset-rtsp-restream
          roles:
            - detect
    onvif:
      host: 192.168.*.**
      port: 8000
      user: ******
      password: ******
    live:
      stream_name: Interior_H
    detect:
      fps: 5
      enabled: true # <---- disable detection until you have a working camera feed
      width: 640 # <---- update for your camera's resolution
      height: 360
    motion:
      threshold: 30
      contour_area: 10
      frame_height: 150
    record:
      enabled: false
      retain:
        days: 10
        mode: all
      alerts:
        retain:
          days: 10
          mode: motion
    objects:
      track:
        - person
        - face
        - license_plate
        - dog
        - cat
        - car
        - amazon
        - fedex
        - ups
        - package
      filters:
        dog:
          min_score: .7
          threshold: .9
        cat:
          min_score: .7
          threshold: .9
        face:
          min_score: .7
        package:
          min_score: .65
          threshold: .9
        license_plate:
          min_score: .6
        amazon:
          min_score: .75
        ups:
          min_score: .75
        fedex:
          min_score: .75
        person:
          min_score: .7
          threshold: .75
          max_area: 60000
          max_ratio: 0.7
        car:
          min_score: 0.70
#         threshold: 0.8
          threshold: .85
          min_area: 4000
          max_area: 100000
  Puerta:
    birdseye:
      order: 2
    ffmpeg:
      inputs:
        - path: rtsp://127.0.0.1:8554/Puerta_L?video=copy&audio=aac
          input_args: preset-rtsp-restream
          roles:
            - record
        - path: rtsp://127.0.0.1:8554/Puerta_L?video=copy
          input_args: preset-rtsp-restream
          roles:
            - detect
      output_args:
        record: preset-record-generic-audio-copy
    live:
      stream_name: Puerta_L
    detect:
      enabled: true # <---- disable detection until you have a working camera feed
      width: 1536
      height: 432
      fps: 5
    motion:
      threshold: 30
      contour_area: 10
    record:
      enabled: true
      retain:
        days: 10
        mode: all
    snapshots:
      required_zones:
        - todas
        - entrada_casa
    zones:
      todas:
        coordinates: 753,432,0,432,0,0,1536,0,1536,432
        objects:
          - dog
          - cat
          - face
          - package
          - license_plate
          - amazon
          - ups
          - fedex
          - person
      entrada_casa:
        coordinates: 68,432,331,248,719,250,870,432
        objects:
          - car
    objects:
      track:
        - person
        - face
        - license_plate
        - dog
        - cat
        - car
        - amazon
        - fedex
        - ups
        - package
      filters:
        dog:
          min_score: .7
          threshold: .9
        cat:
          min_score: .7
          threshold: .9
        face:
          min_score: .7
        package:
          min_score: .65
          threshold: .9
        license_plate:
          min_score: .6
        amazon:
          min_score: .75
        ups:
          min_score: .75
        fedex:
          min_score: .75
        person:
          min_score: .7
          threshold: .75
          max_area: 60000
          max_ratio: 0.7
        car:
          min_score: 0.70
#        threshold: 0.8
          min_area: 4000
#        max_area: 100000    
          mask:
            - 469,59,348,242,998,187,989,34
            - 681,0,0,0,0,432
    review:
      alerts:
        required_zones:
          - todas
          - entrada_casa
  Portero:
    birdseye:
      order: 3
    ffmpeg:
      inputs:
        - path: rtsp://127.0.0.1:8554/Portero_H?video=copy&audio=aac
          input_args: preset-rtsp-restream
          roles:
            - record
        - path: rtsp://127.0.0.1:8554/Portero_L?video=copy
          input_args: preset-rtsp-restream
          roles:
            - detect
      output_args:
        record: preset-record-generic-audio-copy
    live:
      stream_name: Portero_H
    detect:
      enabled: true # <---- disable detection until you have a working camera feed
      width: 640 # <---- update for your camera's resolution
      height: 480
      fps: 5
    motion:
#      threshold: 30
#      contour_area: 10
      mask:
        - 0,0,0,299,40,250,99,246,178,201,231,170,253,144,368,39,640,0,640,0
    record:
      enabled: true
      retain:
        days: 10
        mode: all
    objects:
      track:
        - person
        - face
        - license_plate
        - dog
        - cat
        - car
        - amazon
        - fedex
        - ups
        - package
      filters:
        dog:
          min_score: .7
          threshold: .9
        cat:
          min_score: .7
          threshold: .9
        face:
          min_score: .7
        package:
          min_score: .65
          threshold: .9
        license_plate:
          min_score: .6
        amazon:
          min_score: .75
        ups:
          min_score: .75
        fedex:
          min_score: .75
        person:
          min_score: .7
          threshold: .75
          max_area: 60000
          max_ratio: 0.7
        car:
          mask:
            - 640,159,520,242,640,350
          min_area: 500
timestamp_style:
  position: tl
  format: '%d/%m/%Y %H:%M:%S'
  color:
    red: 255
    green: 255
    blue: 255
  thickness: 2
snapshots:
  enabled: true
  timestamp: true
  bounding_box: true
  retain:
    default: 30
version: 0.15-0
camera_groups:
  Interior:
    order: 1
    icon: LuWarehouse
    cameras:
      - Interior
      - Garaje
  Exterior:
    order: 2
    icon: LuFlower2
    cameras:
      - Jacuzzi
      - Portero
      - Pozo
      - Puerta
      - Rocalla
auth:
  failed_login_rate_limit: 1/second;5/minute;20/hour
  trusted_proxies:
    - 172.18.0.0/16
tls:
  enabled: true
notifications:
  enabled: 'true'
  email: *****`
NickM-27 commented 2 months ago

I have put up a PR with some fixes https://github.com/blakeblackshear/frigate/pull/13518