blakeblackshear / frigate

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

[Config Support]: No clips available #5969

Closed fyrstyk closed 1 year ago

fyrstyk commented 1 year ago

Describe the problem you are having

I have configured frigate today with required zones as I only want to see recordings/events when there is a person in a zone.

Zones appear to be working, and I can see snapshots from the camera, but I now no longer have any clips. Recordings are being made, and have confirmed by looking at local storage, but no clips available in the GUI and it is greyed out.

clip

Version

0.11.1-2EADA21

Frigate config file

# yaml-language-server: $schema=http://battersea:5000/api/config/schema

mqtt:
  host: mosquitto
  user: u32-1
  password: 

detectors:
  coral:
    type: edgetpu
    device: usb

birdseye:
  enabled: True
  mode: continuous
  width: 1920
  height: 1080
  quality: 1

ffmpeg:
#  input_args:
#    - -avoid_negative_ts
#    - make_zero
  hwaccel_args: -hwaccel vaapi -hwaccel_device /dev/dri/renderD128 -hwaccel_output_format yuv420p
  output_args:
    record: -f segment -segment_time 10 -segment_format mp4 -reset_timestamps 1 -strftime 1 -c:v copy -c:a aac

#logger:
  # Optional: default log level (default: shown below)
  #default: debug
  # Optional: module by module log level configuration
  #logs:
  #  frigate.mqtt: error

cameras:

  East: # <------ Name the camera
    ui:
      order: 1
    ffmpeg:
      inputs:
        - path: rtsp://u321cctv:xxx@10.10.10.240:554/stream1 # <----- Update for your camera
          roles:
            - record
            - rtmp

        - path: rtsp://u321cctv:xxx@10.10.10.240:554/stream2 # <----- Update for your camera
          roles:
            - detect

    rtmp:
      enabled: True # <-- RTMP should be disabled if your stream is not H264

    detect:
      width: 640 # <---- update for your camera's resolution
      height: 360 # <---- update for your camera's resolution
      fps: 5
      stationary:
        interval: 5
        threshold: 50

    motion:
      mask:
        # Cable and timestamp
        - 0,175,224,30,228,0,0,0
        # - 2560,0,2560,141,2051,61,1533,62,639,258,650,319,552,376,178,655,0,801,0,0
        # 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. 25 default
      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. 30 default
        # As a rule of thumb:
        #  - 15 - high sensitivity
        #  - 30 - medium sensitivity
        #  - 50 - low sensitivity
      contour_area: 15
        # 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
      improve_contrast: True

    objects:
      track:
        - person
        - dog
        - cat
        - sheep
        - cow
        - horse
        - umbrella

      filters:
        person:
          mask:
            - 0,0,380,0,214,36,0,179

    snapshots:
      enabled: True
      bounding_box: True
      height: 360
      retain:
        default: 14
      required_zones:
        - doorbell_east

    record:
      enabled: True
      retain:
        mode: motion
        days: 14
      events:
        retain:
          default: 14
        pre_capture: 5
        post_capture: 120
        objects:
          - dog
          - cat
          - sheep
          - cow
          - horse
        required_zones:
          - doorbell_east

    zones:
      doorbell_east:
        coordinates: 640,360,0,360,0,319,460,68,640,103
        objects:
          - person
          - umbrella

  South: # <------ Name the camera
    ui:
      order: 0
    ffmpeg:
      inputs:
        - path: rtsp://u321cctv:xxx@10.10.10.241:554/stream1 # <----- Update for your camera
          roles:
            - record
          #  - detect
            - rtmp

        - path: rtsp://u321cctv:xxx@10.10.10.241:554/stream2 # <----- Update for your camera
          roles:
            - detect

    rtmp:
      enabled: True # <-- RTMP should be disabled if your stream is not H264

    detect:
      width: 640 # <---- update for your camera's resolution
      height: 360 # <---- update for your camera's resolution
      fps: 5
      stationary:
        interval: 5
        threshold: 50

    motion:
      mask:
        - 0,21,231,21,228,0,0,0
      #  - 2560,233,2560,0,1966,0
      #  - 2560,1440,2560,633,2097,1440
      #  - 789,0,791,59,0,61,0,0
        # 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. 25 default
      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. 30 default
        # As a rule of thumb:
        #  - 15 - high sensitivity
        #  - 30 - medium sensitivity
        #  - 50 - low sensitivity
      contour_area: 15
        # 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
      improve_contrast: True

    objects:
      track:
        - person
        - sheep
        - dog
        - cat
        - sheep
        - cow
        - horse
        - umbrella

    snapshots:
      enabled: True
      bounding_box: True
      height: 360
      retain:
        default: 7
      required_zones:
        - doorbell_south

    record:
      enabled: True
      retain:
        mode: motion
        days: 7
      events:
        retain:
          default: 7
        pre_capture: 5
        post_capture: 120
        objects:
          - dog
          - cat
          - sheep
          - cow
          - horse
        required_zones:
          - doorbell_south

    zones:
      doorbell_south:
        coordinates: 0,360,195,360,61,107,0,131 
        objects:
          - person
          - umbrella

  West: # <------ Name the camera
    ui:
      order: 3
    ffmpeg:
      inputs:
        - path: rtsp://u321cctv:xxx@10.10.10.242:554/Streaming/Channels/101/ # <----- Update for your camera
          roles:
            - record
            - rtmp

        - path: rtsp://u321cctv:xxx@10.10.10.242:554/Streaming/Channels/103/ # <----- Update for your camera
          roles:
            - detect

    rtmp:
      enabled: True # <-- RTMP should be disabled if your stream is not H264

    detect:
      width: 1280 # <---- update for your camera's resolution
      height: 720 # <---- update for your camera's resolution
      fps: 6
      stationary:
        interval: 5
        threshold: 50
        max_frames:
          objects:
            car: 750

    motion:
      mask:
        # Timestamp
        - 30,24,335,24,335,2,30,2
        # Cable
        - 957,720,1020,720,932,58,902,63
        #- 59,94,672,95,672,38,57,39
        # 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. 25 default
      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. 30 default
        # As a rule of thumb:
        #  - 15 - high sensitivity
        #  - 30 - medium sensitivity
        #  - 50 - low sensitivity
      contour_area: 15
        # 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
      improve_contrast: True

    objects:
      track:
        - person
        - car
        - dog
        - cat
        - sheep
        - cow
        - horse
        - umbrella

      filters:
        person:
          mask:
            - 0,0,743,0,1280,0,1280,155,915,114,348,122,0,204

    snapshots:
      enabled: True
      bounding_box: True
      height: 720
      retain:
        default: 14
      required_zones:
        - person_west
        - car_west

    record:
      enabled: True
      retain:
        mode: motion
        days: 14
      events:
        retain:
          default: 14
        pre_capture: 5
        post_capture: 120
        objects:
          - dog
          - cat
          - sheep
          - cow
          - horse
        required_zones:
          - person_west
          - car_west

    zones:
      person_west:
        coordinates: 0,720,1280,720,1280,311,1176,225,147,395,147,503,0,549
        objects:
          - person
          - umbrella
      car_west:
        coordinates: 170,664,848,607,1280,487,1280,347,718,438,179,485
        objects:
          - car

Relevant log output

[2023-04-10 15:38:54] peewee_migrate                 INFO    : There is nothing to migrate
[2023-04-10 15:38:54] frigate.app                    INFO    : Output process started: 217
[2023-04-10 15:38:54] ws4py                          INFO    : Using epoll
[2023-04-10 15:38:54] frigate.app                    INFO    : Camera processor started for East: 223
[2023-04-10 15:38:54] frigate.app                    INFO    : Camera processor started for South: 226
[2023-04-10 15:38:54] frigate.app                    INFO    : Camera processor started for West: 228
[2023-04-10 15:38:54] frigate.app                    INFO    : Capture process started for East: 230
[2023-04-10 15:38:54] frigate.app                    INFO    : Capture process started for South: 232
[2023-04-10 15:38:54] frigate.app                    INFO    : Capture process started for West: 233
[2023-04-10 15:38:54] ws4py                          INFO    : Using epoll
[2023-04-10 15:38:54] detector.coral                 INFO    : Starting detection process: 216
[2023-04-10 15:38:54] frigate.edgetpu                INFO    : Attempting to load TPU as usb
[2023-04-10 15:38:57] frigate.edgetpu                INFO    : TPU found
[2023-04-10 15:39:54] ffmpeg.West.record_rtmp        ERROR   : [aac @ 0x55dd449f5640] Too many bits 8832.000000 > 6144 per frame requested, clamping to max
[2023-04-10 15:39:54] ffmpeg.West.record_rtmp        ERROR   : [segment @ 0x55dd449f2380] Timestamps are unset in a packet for stream 0. This is deprecated and will stop working in the future. Fix your code to set the timestamps properly
[2023-04-10 15:39:54] ffmpeg.West.record_rtmp        ERROR   : [flv @ 0x55dd449f1e80] Timestamps are unset in a packet for stream 0. This is deprecated and will stop working in the future. Fix your code to set the timestamps properly
[2023-04-10 15:39:54] ffmpeg.West.record_rtmp        ERROR   : [segment @ 0x55dd449f2380] Non-monotonous DTS in output stream 0:0; previous: 0, current: 0; changing to 1. This may result in incorrect timestamps in the output file.
[2023-04-10 15:39:54] ffmpeg.West.record_rtmp        ERROR   : [aac @ 0x55dd449f5640] Queue input is backward in time
[2023-04-10 15:39:54] ffmpeg.West.record_rtmp        ERROR   : [segment @ 0x55dd449f2380] Non-monotonous DTS in output stream 0:1; previous: 18233, current: 18000; changing to 18234. This may result in incorrect timestamps in the output file.
[2023-04-10 15:39:54] ffmpeg.West.record_rtmp        ERROR   : [aac @ 0x55dd449f5640] Queue input is backward in time
[2023-04-10 15:39:54] ffmpeg.West.record_rtmp        ERROR   : [segment @ 0x55dd449f2380] Non-monotonous DTS in output stream 0:1; previous: 65314, current: 65312; changing to 65315. This may result in incorrect timestamps in the output file.
[2023-04-10 15:39:54] ffmpeg.West.record_rtmp        ERROR   : [aac @ 0x55dd449f5640] Queue input is backward in time
[2023-04-10 15:39:54] ffmpeg.West.record_rtmp        ERROR   : [segment @ 0x55dd449f2380] Non-monotonous DTS in output stream 0:1; previous: 191894, current: 191869; changing to 191895. This may result in incorrect timestamps in the output file.
[2023-04-10 15:39:54] ffmpeg.West.record_rtmp        ERROR   : [aac @ 0x55dd449f5640] Queue input is backward in time
[2023-04-10 15:39:54] ffmpeg.West.record_rtmp        ERROR   : [segment @ 0x55dd449f2380] Non-monotonous DTS in output stream 0:1; previous: 432910, current: 432737; changing to 432911. This may result in incorrect timestamps in the output file.
[2023-04-10 15:39:54] ffmpeg.West.record_rtmp        ERROR   : av_interleaved_write_frame(): Connection reset by peer
[2023-04-10 15:39:54] ffmpeg.West.record_rtmp        ERROR   : [flv @ 0x55dd449f1e80] Failed to update header with correct duration.
[2023-04-10 15:39:54] ffmpeg.West.record_rtmp        ERROR   : [flv @ 0x55dd449f1e80] Failed to update header with correct filesize.
[2023-04-10 15:39:54] ffmpeg.West.record_rtmp        ERROR   : Error writing trailer of rtmp://127.0.0.1/live/West: Connection reset by peer
[2023-04-10 15:39:54] ffmpeg.West.record_rtmp        ERROR   : Error closing file rtmp://127.0.0.1/live/West: Broken pipe
[2023-04-10 15:39:54] watchdog.West                  INFO    : Terminating the existing ffmpeg process...
[2023-04-10 15:39:54] watchdog.West                  INFO    : Waiting for ffmpeg to exit gracefully...

Frigate stats

{"East":{"camera_fps":5.1,"capture_pid":229,"detection_fps":0.0,"pid":220,"process_fps":5.1,"skipped_fps":0.0},"South":{"camera_fps":5.0,"capture_pid":233,"detection_fps":6.4,"pid":223,"process_fps":5.0,"skipped_fps":0.0},"West":{"camera_fps":6.1,"capture_pid":235,"detection_fps":13.1,"pid":225,"process_fps":6.1,"skipped_fps":0.0},"detection_fps":19.5,"detectors":{"coral":{"detection_start":0.0,"inference_speed":10.82,"pid":215}},"service":{"latest_version":"0.12.0","storage":{"/dev/shm":{"free":264.9,"mount_type":"tmpfs","total":268.4,"used":3.6},"/media/frigate/clips":{"free":887810.4,"mount_type":"exfat","total":4000768.3,"used":3112957.9},"/media/frigate/recordings":{"free":887810.4,"mount_type":"exfat","total":4000768.3,"used":3112957.9},"/tmp/cache":{"free":1993.4,"mount_type":"tmpfs","total":2000.0,"used":6.6}},"temperatures":{},"uptime":1597,"version":"0.11.1-2eada21"}}

Operating system

Other Linux

Install method

Docker Compose

Coral version

USB

Any other information that may be helpful

No response

NickM-27 commented 1 year ago

I would suggest updating to 0.12, looks like your cameras record process is having some issues and that is most likely the problem. RTMP is causing the stream to crash

fyrstyk commented 1 year ago

Hi NickM-27

Would that error cause the clips to be missing?

I've only had the issue with clips since adding:

required_zones:

Otherwise, clips are generated without issue, and there are no issues with recordings either. All my events earlier today had clips, and the issue has only arisen since adding required_zones.

I've had difficulty with required zones previously and may be missing something in the config.

NickM-27 commented 1 year ago

we can see at least one of the cameras failed here: ffmpeg.West.record_rtmp ERROR : Error writing trailer of rtmp://127.0.0.1/live/West: Connection reset by peer and these logs are from after the event you are showing.

You're also saying you have issues with person_west / car_west but your screenshot is showing the east camera.

in general your required_zones looks like from what I can see

fyrstyk commented 1 year ago

Apologies

The clips issue is on all my cameras, east, west, and south.

West is a new camera, and I have noted the issues with that, and was going to investigate further.

Even with east and south cameras only I get the same behaviour regarding clips.

I tried setting up required zones late last year to reduce false triggers from areas I was not interested in and gave up as I had the same issue with clips.

west clip south

NickM-27 commented 1 year ago

I would suggest reducing your config to this:

# yaml-language-server: $schema=http://battersea:5000/api/config/schema

mqtt:
  host: mosquitto
  user: u32-1
  password: 

detectors:
  coral:
    type: edgetpu
    device: usb

birdseye:
  enabled: True
  mode: continuous
  width: 1920
  height: 1080
  quality: 1

ffmpeg:
#  input_args:
#    - -avoid_negative_ts
#    - make_zero
  hwaccel_args: -hwaccel vaapi -hwaccel_device /dev/dri/renderD128 -hwaccel_output_format yuv420p
  output_args:
    record: -f segment -segment_time 10 -segment_format mp4 -reset_timestamps 1 -strftime 1 -c:v copy -c:a aac

#logger:
  # Optional: default log level (default: shown below)
  #default: debug
  # Optional: module by module log level configuration
  #logs:
  #  frigate.mqtt: error

cameras:

  East: # <------ Name the camera
    ui:
      order: 1
    ffmpeg:
      inputs:
        - path: rtsp://u321cctv:xxx@10.10.10.240:554/stream1 # <----- Update for your camera
          roles:
            - record
            - rtmp

        - path: rtsp://u321cctv:xxx@10.10.10.240:554/stream2 # <----- Update for your camera
          roles:
            - detect

    rtmp:
      enabled: True # <-- RTMP should be disabled if your stream is not H264

    detect:
      width: 640 # <---- update for your camera's resolution
      height: 360 # <---- update for your camera's resolution
      fps: 5
      stationary:
        interval: 5
        threshold: 50

    motion:
      mask:
        # Cable and timestamp
        - 0,175,224,30,228,0,0,0
        # - 2560,0,2560,141,2051,61,1533,62,639,258,650,319,552,376,178,655,0,801,0,0
        # 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. 25 default
      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. 30 default
        # As a rule of thumb:
        #  - 15 - high sensitivity
        #  - 30 - medium sensitivity
        #  - 50 - low sensitivity
      contour_area: 15
        # 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
      improve_contrast: True

    objects:
      track:
        - person
        - dog
        - cat
        - sheep
        - cow
        - horse
        - umbrella

      filters:
        person:
          mask:
            - 0,0,380,0,214,36,0,179

    snapshots:
      enabled: True
      bounding_box: True
      height: 360
      retain:
        default: 14
      required_zones:
        - doorbell_east

    record:
      enabled: True
      retain:
        mode: motion
        days: 14
      events:
        retain:
          default: 14
        pre_capture: 5
        post_capture: 120
        required_zones:
          - doorbell_east

    zones:
      doorbell_east:
        coordinates: 640,360,0,360,0,319,460,68,640,103
        objects:
          - person
          - umbrella

  South: # <------ Name the camera
    ui:
      order: 0
    ffmpeg:
      inputs:
        - path: rtsp://u321cctv:xxx@10.10.10.241:554/stream1 # <----- Update for your camera
          roles:
            - record
          #  - detect
            - rtmp

        - path: rtsp://u321cctv:xxx@10.10.10.241:554/stream2 # <----- Update for your camera
          roles:
            - detect

    rtmp:
      enabled: True # <-- RTMP should be disabled if your stream is not H264

    detect:
      width: 640 # <---- update for your camera's resolution
      height: 360 # <---- update for your camera's resolution
      fps: 5
      stationary:
        interval: 5
        threshold: 50

    motion:
      mask:
        - 0,21,231,21,228,0,0,0
      #  - 2560,233,2560,0,1966,0
      #  - 2560,1440,2560,633,2097,1440
      #  - 789,0,791,59,0,61,0,0
        # 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. 25 default
      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. 30 default
        # As a rule of thumb:
        #  - 15 - high sensitivity
        #  - 30 - medium sensitivity
        #  - 50 - low sensitivity
      contour_area: 15
        # 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
      improve_contrast: True

    objects:
      track:
        - person
        - sheep
        - dog
        - cat
        - sheep
        - cow
        - horse
        - umbrella

    snapshots:
      enabled: True
      bounding_box: True
      height: 360
      retain:
        default: 7
      required_zones:
        - doorbell_south

    record:
      enabled: True
      retain:
        mode: motion
        days: 7
      events:
        retain:
          default: 7
        pre_capture: 5
        post_capture: 120
        required_zones:
          - doorbell_south

    zones:
      doorbell_south:
        coordinates: 0,360,195,360,61,107,0,131 
        objects:
          - person
          - umbrella

  West: # <------ Name the camera
    ui:
      order: 3
    ffmpeg:
      inputs:
        - path: rtsp://u321cctv:xxx@10.10.10.242:554/Streaming/Channels/101/ # <----- Update for your camera
          roles:
            - record
            - rtmp

        - path: rtsp://u321cctv:xxx@10.10.10.242:554/Streaming/Channels/103/ # <----- Update for your camera
          roles:
            - detect

    rtmp:
      enabled: True # <-- RTMP should be disabled if your stream is not H264

    detect:
      width: 1280 # <---- update for your camera's resolution
      height: 720 # <---- update for your camera's resolution
      fps: 6
      stationary:
        interval: 5
        threshold: 50
        max_frames:
          objects:
            car: 750

    motion:
      mask:
        # Timestamp
        - 30,24,335,24,335,2,30,2
        # Cable
        - 957,720,1020,720,932,58,902,63
        #- 59,94,672,95,672,38,57,39
        # 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. 25 default
      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. 30 default
        # As a rule of thumb:
        #  - 15 - high sensitivity
        #  - 30 - medium sensitivity
        #  - 50 - low sensitivity
      contour_area: 15
        # 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
      improve_contrast: True

    objects:
      track:
        - person
        - car
        - dog
        - cat
        - sheep
        - cow
        - horse
        - umbrella

      filters:
        person:
          mask:
            - 0,0,743,0,1280,0,1280,155,915,114,348,122,0,204

    snapshots:
      enabled: True
      bounding_box: True
      height: 720
      retain:
        default: 14
      required_zones:
        - person_west
        - car_west

    record:
      enabled: True
      retain:
        mode: motion
        days: 14
      events:
        retain:
          default: 14
        pre_capture: 5
        post_capture: 120
        required_zones:
          - person_west
          - car_west

    zones:
      person_west:
        coordinates: 0,720,1280,720,1280,311,1176,225,147,395,147,503,0,549
        objects:
          - person
          - umbrella
      car_west:
        coordinates: 170,664,848,607,1280,487,1280,347,718,438,179,485
        objects:
          - car
fyrstyk commented 1 year ago

That seems to have done the trick, thank you very much!

Will frigate still record the other objects in the track list outside the required zones?

What I was trying to achieve was to record all the objects in my track list, but only cars/people in the required zones.

Can you explain where I went wrong?

Thanks again :)

NickM-27 commented 1 year ago

it depends what you mean by record. You have 24/7 recording enabled so it will of course record and track all objects, but you will not get events for any objects that are not listed in the zones

fyrstyk commented 1 year ago

I would like to see events for the other objects, sheep, dog, cat etc but anywhere in the image.

NickM-27 commented 1 year ago

I would like to see events for the other objects, sheep, dog, cat etc but anywhere in the image.

then you need to create a separate zone that covers the entire image with only those objects

fyrstyk commented 1 year ago

Ok, thanks.

Very much appreciate your help.

NickM-27 commented 1 year ago

Feel free to create a new issue if something else comes up