frigate icon indicating copy to clipboard operation
frigate copied to clipboard

[Support]: Two events shown as one recording

Open B0ndo2 opened this issue 2 years ago • 14 comments

Describe the problem you are having

Scenario: 1- My car drove into my driveway zone and was detected (car) and was stopped there for about 30 minutes. 2- Later I walked out on foot passed by the car

Outcome: One video recording showing the car driving in and myself leaving on foot (1) then a couple of seconds later showing myself walking by the car (2) (4 hours later and it still shows as in progress) There is also another clip for me detected as person

Expected: Two different clips: Car driving in (car detected) Myself walking on foot ( person detected)

Version

0.11.1-2eada21

Frigate config file

# frigate.yml
detectors:
  cpu1:
    type: cpu
mqtt:
  # Required: host name
  host: xyz.duckdns.org
  # Optional: port (default: shown below)
  port: 1883
  # Optional: topic prefix (default: shown below)
  # WARNING: must be unique if you are running multiple instances
  topic_prefix: frigate
  # Optional: client id (default: shown below)
  # WARNING: must be unique if you are running multiple instances
  client_id: frigate
  # Optional: user
  user: frigate
  # Optional: password
  # NOTE: Environment variables that begin with 'FRIGATE_' may be referenced in {}.
  #       eg. password: '{FRIGATE_MQTT_PASSWORD}'
  password: fdsfdsfds
  # Optional: interval in seconds for publishing stats (default: shown below)
  stats_interval: 60
rtmp:
  enabled: false

#motion:
#  contour_area: 100
#  delta_alpha: 0.2
#  frame_alpha: 0.2
#  frame_height: 80
#  threshold: 25
  
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: continuous
  
cameras:
  driveway:
    zones:
      sidewalk:
        coordinates: 70,49,225,34,315,28,499,30,640,46,640,0,0,0,0,63
        objects:
          - car
      drive_way:
        coordinates: 296,32,488,33,640,57,640,352,0,352,0,65,130,44
        objects:
          - person
          - car
    objects:
      track:
        - person
        - car
      filters:
        person:
          mask:
            - 70,49,225,34,315,28,499,30,640,46,640,0,0,0,0,63
#            - 95,38,317,64,640,130,640,0,0,0,0,42
#          min_score: 0.49
          threshold: 0.58
          min_area: 3200
          max_area: 30320
    ffmpeg:
      inputs:
        - path: rtsp://admin:[email protected]/2
          roles:
            - detect
        - path: rtsp://admin:[email protected]/1
          roles:
            - record
    detect:    
      width: 640
      height: 352
      fps: 7  
#      stationary:
#        interval: 14
#    motion:
#      mask:
#        - 70,49,225,34,315,28,499,30,640,46,640,0,0,0,0,63
#        - 95,38,317,64,640,130,640,0,0,0,0,42         
    record:
      enabled: true
      retain:
        days: 0
      events:
        required_zones:
          - drive_way
          - sidewalk
        retain:
          default: 5
          mode: active_objects
    snapshots:
      enabled: True
      bounding_box: True
      required_zones:
        - drive_way
        - sidewalk
      timestamp: True      
      retain:
        default: 7


################################################ 
  front_porch_camera:
    objects:
      track:
        - person
      filters:
        person:
          mask:
            - 148,348,171,122,173,12,377,8,518,57,640,80,640,0,0,0,0,352         
    ffmpeg:
      inputs:
        - path: rtsp://admin:[email protected]/2
          roles:
            - detect
        - path: rtsp://admin:[email protected]/1
          roles:
            - record
    detect:    
      width: 640
      height: 352
      fps: 5  
    motion:
      mask:
        - 148,348,171,122,173,12,377,8,518,57,640,80,640,0,0,0,0,352         
    record:
      enabled: true
      retain:
        days: 0
      events:
        retain:
          default: 5
          mode: motion
    snapshots:
      enabled: True
      bounding_box: True
      timestamp: True      
      retain:
        default: 7

Relevant log output

NA

FFprobe output from your camera

NA

Frigate stats

No response

Operating system

HassOS

Install method

HassOS Addon

Coral version

CPU (no coral)

Network connection

Wireless

Camera make and model

Chortau

Any other information that may be helpful

No response

B0ndo2 avatar Jan 09 '23 17:01 B0ndo2

The event for your car will be there and ongoing as long as the car is in the frame. The event will not stop after the car stops moving. So the event including the part of you walking out is the correct and expected behavior.

There should be a separate event also for person.

NickM-27 avatar Jan 09 '23 17:01 NickM-27

Ok but then the problem is that it becomes not so useful as it is a time compressed clip. Anyone who walks by the car will be added to the clip and there is no way for me to tell when that person was present by looking at the clip. To make it clear. The event started at 8:02 and I walked by again at 8:35 and if someone else walks by at 12p, s/he will be added to the same clip and playing it back will make it look like it was once continuous stream of events. Why would a person be added to the clip for a car detection ?

B0ndo2 avatar Jan 09 '23 17:01 B0ndo2

Why would a person be added to the clip for a car detection ?

Because the event is for the car and the car is still there and your recording retention policy is

record:
      events:
        retain:
          default: 5
          mode: active_objects

which means it only keeps recording segments for that event where an object is active (in this case you)

NickM-27 avatar Jan 09 '23 17:01 NickM-27

Suggest reading the docs https://docs.frigate.video/configuration/record#what-do-the-different-retain-modes-mean as there is an example exactly about this

NickM-27 avatar Jan 09 '23 17:01 NickM-27

But if no "person" walked in and detected, then there would have been no recording for that moment. I guess what I saying here is that a "person" is what triggered saving a clip section as part of a "car" event.

How can this be fixed?. The clip is not useful now because it's not an actual representation of time

B0ndo2 avatar Jan 09 '23 17:01 B0ndo2

Suggest reading the docs https://docs.frigate.video/configuration/record#what-do-the-different-retain-modes-mean as there is an example exactly about this

I read it a few time but I can't seem to figure out what is wrong with my config.

I need to keep a recording as a car goes on my drive way but not when it becomes static I also need to record a person walking on the driveway regardless of the car but I don't want that person to be in the car clip

B0ndo2 avatar Jan 09 '23 17:01 B0ndo2

I need to keep a recording as a car goes on my drive way but not when it becomes static I also need to record a person walking on the driveway regardless of the car but I don't want that person to be in the car clip

There is no official way to do that. You could try to forcefully end the car event with a car object mask or max_frames but that would lead to the car being redected later and starting a new car event.

If you have timestamps on your recordings then I fail to see why it would be an issue as it would be clear when the car parked and when the person walked out.

NickM-27 avatar Jan 09 '23 17:01 NickM-27

I need to keep a recording as a car goes on my drive way but not when it becomes static I also need to record a person walking on the driveway regardless of the car but I don't want that person to be in the car clip

There is no official way to do that. You could try to forcefully end the car event with a car object mask or max_frames but that would lead to the car being redected later and starting a new car event.

Maybe that could be a new feature, if the object is not of the same type (i.e. car in this case), don't append that segment to the car detected clip

If you have timestamps on your recordings then I fail to see why it would be an issue as it would be clear when the car parked and when the person walked out.

I don't have timestamps (issues with the camera resetting it's TZ randomly

B0ndo2 avatar Jan 09 '23 18:01 B0ndo2

Maybe an option to add timestamp on the video (the first couple of seconds or so) ?

B0ndo2 avatar Jan 09 '23 21:01 B0ndo2

I also need to record a person walking on the driveway regardless of the car but I don't want that person to be in the car clip

You can already do that with ffmpeg but it requires decoding and reencoding the video which will use lots of GPU/CPU for recording

NickM-27 avatar Jan 09 '23 21:01 NickM-27

I also need to record a person walking on the driveway regardless of the car but I don't want that person to be in the car clip

You can already do that with ffmpeg but it requires decoding and reencoding the video which will use lots of GPU/CPU for recording

Not sure I understand, how can I do this with ffmpeg ?

ffmpeg doesn't know anything about the content of the video.

B0ndo2 avatar Jan 09 '23 21:01 B0ndo2

https://superuser.com/questions/1491264/ffmpeg-filter-to-add-timestamp-on-video

NickM-27 avatar Jan 09 '23 21:01 NickM-27

https://superuser.com/questions/1491264/ffmpeg-filter-to-add-timestamp-on-video

Aha, you were referring to the timestamp comment but you quoted the recording piece so I was confused :)

B0ndo2 avatar Jan 09 '23 21:01 B0ndo2

Oh shoot, that must have been a GitHub mobile app bug, didn't realize that it didn't quote what I wanted it to. Sorry about that.

NickM-27 avatar Jan 09 '23 21:01 NickM-27

This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.

github-actions[bot] avatar Feb 09 '23 00:02 github-actions[bot]