Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Camera Support]: Trying to set up PTZ auto tracking #9873

Closed
dakotasoukup opened this issue Feb 15, 2024 · 1 comment
Closed

[Camera Support]: Trying to set up PTZ auto tracking #9873

dakotasoukup opened this issue Feb 15, 2024 · 1 comment

Comments

@dakotasoukup
Copy link

Describe the problem you are having

Im trying to set up auto tracking... Not sure if my camera is capable. I successfully connected to it and can use the frigate controller to move it. When trying to add the auto detect feature frigate wont load.

Version

0.13.1-34fb1c2

Frigate config file

mqtt:
  host: 192.168.0.170
  port: 1883 # <---- same mqtt broker that home assistant uses
  user: dakota
  password: foster47290

ffmpeg:
  hwaccel_args: preset-vaapi

detectors:
  coral:
    type: edgetpu
    device: pci

  
detect:
  # Optional: width of the frame for the input with the detect role (default: use native stream resolution)
  width: 1280
  # Optional: height of the frame for the input with the detect role (default: use native stream resolution)
  height: 720
  # Optional: desired fps for your camera for the input with the detect role (default: shown below)
  # NOTE: Recommended value of 5. Ideally, try and reduce your FPS on the camera.
  fps: 5
  # Optional: enables detection for the camera (default: True)
  enabled: True
  # Optional: Number of consecutive detection hits required for an object to be initialized in the tracker. (default: 1/2 the frame rate)
  min_initialized: 2
  # Optional: Number of frames without a detection before Frigate considers an object to be gone. (default: 5x the frame rate)
  max_disappeared: 25
  # Optional: Configuration for stationary object tracking
  stationary:
    # Optional: Frequency for confirming stationary objects (default: same as threshold)
    # When set to 1, object detection will run to confirm the object still exists on every frame.
    # If set to 10, object detection will run to confirm the object still exists on every 10th frame.
    interval: 50
    # Optional: Number of frames without a position change for an object to be considered stationary (default: 10x the frame rate or 10s)
    threshold: 50
    # Optional: Define a maximum number of frames for tracking a stationary object (default: not set, track forever)
    # This can help with false positives for objects that should only be stationary for a limited amount of time.
    # It can also be used to disable stationary object tracking. For example, you may want to set a value for person, but leave
    # car at the default.
    # WARNING: Setting these values overrides default behavior and disables stationary object tracking.
    #          There are very few situations where you would want it disabled. It is NOT recommended to
    #          copy these values from the example config into your config unless you know they are needed.
    max_frames:
      # Optional: Default for all object types (default: not set, track forever)
      default: 3000
      # Optional: Object specific values
      objects:
        person: 1000
  # Optional: Milliseconds to offset detect annotations by (default: shown below).
  # There can often be latency between a recording and the detect process,
  # especially when using separate streams for detect and record.
  # Use this setting to make the timeline bounding boxes more closely align
  # with the recording. The value can be positive or negative.
  # TIP: Imagine there is an event clip with a person walking from left to right.
  #      If the event timeline bounding box is consistently to the left of the person
  #      then the value should be decreased. Similarly, if a person is walking from
  #      left to right and the bounding box is consistently ahead of the person
  #      then the value should be increased.
  # TIP: This offset is dynamic so you can change the value and it will update existing
  #      events, this makes it easy to tune.
  # WARNING: Fast moving objects will likely not have the bounding box align.
  annotation_offset: 0
      
#Global Object Settings
objects:
  track:
    - person
    - car
    - dog


record:
  enabled: True
  retain:
    days: 7
    mode: all
  events:
    retain:
      default: 30
      mode: motion

snapshots:
  enabled: True
  retain:
    default: 30



birdseye:
  enabled: True
  mode: continuous
  
cameras:
  Backyard: # <--- this will be changed to your actual camera later
    enabled: True
    ffmpeg:
      inputs:
        - path: rtsp://admin:123456@192.168.0.14/media/video2
          roles:
            - detect
            - rtmp # <- deprecated, recommend using restream instead
        - path: rtsp://admin:123456@192.168.0.14/media/video1
          roles:
            - record  
    motion:
       mask:    
        - 0,0,0,85,355,79,361,0            
  front: # <--- this will be changed to your actual camera later
    enabled: True
    ffmpeg:
      inputs:
        - path: rtsp://Admin:123456@192.168.0.44/stream1?username=admin&password=E10ADC3949BA59ABBE56E057F20F883E
          roles:
            - detect
            - rtmp # <- deprecated, recommend using restream instead
        - path: rtsp://Admin:123456@192.168.0.44/stream0?username=admin&password=E10ADC3949BA59ABBE56E057F20F883E
          roles:
            - record 
    motion:
        mask:  
            - 754,720,743,620,1280,667,1280,720            

  front2: # <--- this will be changed to your actual camera later
    enabled: True
    ffmpeg:
      inputs:
        - path: rtsp://admin:Foster47290@192.168.0.233:554/Streaming/channels/2
          roles:
            - detect
            - rtmp # <- deprecated, recommend using restream instead
        - path: rtsp://admin:Foster47290@192.168.0.233:554
          roles:
            - record   
    onvif:
      host: 192.168.0.233
      port: 80
      user: admin
      password: Foster47290 
      autotracking:
        # Optional: enable/disable object autotracking. (default: shown below)
        enabled: True
        # Optional: calibrate the camera on startup (default: shown below)
        # A calibration will move the PTZ in increments and measure the time it takes to move.
        # The results are used to help estimate the position of tracked objects after a camera move.
        # Frigate will update your config file automatically after a calibration with
        # a "movement_weights" entry for the camera. You should then set calibrate_on_startup to False.
        calibrate_on_startup: True
        # Optional: the mode to use for zooming in/out on objects during autotracking. (default: shown below)
        # Available options are: disabled, absolute, and relative
        #   disabled - don't zoom in/out on autotracked objects, use pan/tilt only
        #   absolute - use absolute zooming (supported by most PTZ capable cameras)
        #   relative - use relative zooming (not supported on all PTZs, but makes concurrent pan/tilt/zoom movements)
        zooming: absolute 
        # Optional: A value to change the behavior of zooming on autotracked objects. (default: shown below)
        # A lower value will keep more of the scene in view around a tracked object.
        # A higher value will zoom in more on a tracked object, but Frigate may lose tracking more quickly.
        # The value should be between 0.1 and 0.75
        zoom_factor: 0.3
        # Optional: list of objects to track from labelmap.txt (default: shown below)
        track:
          - person
        # Required: Begin automatically tracking an object when it enters any of the listed zones.
        required_zones:
          - van
        # Required: Name of ONVIF preset in camera's firmware to return to when tracking is over. (default: shown below)
        return_preset: van
        # Optional: Seconds to delay before returning to preset. (default: shown below)
        timeout: 10
        # Optional: Values generated automatically by a camera calibration. Do not modify these manually. (default: shown below)
        movement_weights: [0]  
    objects:
      filters:
        car:
          mask:
                 - 0,0,0,251,314,403,600,405,1163,156    
    motion:
         mask:
              - 0,267,0,0,1280,0,1280,511                       

  driveway: # <--- this will be changed to your actual camera later
    enabled: True
    ffmpeg:
      inputs:
        - path: rtsp://admin:123456@192.168.0.22/media/video2
          roles:
            - detect
            - rtmp # <- deprecated, recommend using restream instead
        - path: rtsp://admin:123456@192.168.0.22/media/video1
          roles:
            - record   
    record:
      events:
        required_zones:
        - zone_2
    zones:
        zone_1:
          coordinates: 388,0,28,170,371,389,1099,300,1220,136
        zone_2:
          coordinates: 747,335,911,264,1057,341,1016,501,821,635,75,628
    objects:
        filters:
          car:
            mask:
             - 809,27,656,0,383,68,400,81,304,126,582,427,1000,195,1022,124    
    motion:
      mask:
        - 0,0,0,95,288,151,378,0
  garage: # <--- this will be changed to your actual camera later
    enabled: True
    ffmpeg:
      inputs:
        - path: rtsp://admin:123456@192.168.0.23/media/video2
          roles:
            - detect
            - rtmp # <- deprecated, recommend using restream instead
        - path: rtsp://admin:123456@192.168.0.23/media/video1
          roles:
            - record 
    motion:
      mask:  
          - 0,0,0,78,314,79,322,0        
    
go2rtc:
  streams:
    front2:
      - rtsp://admin:Foster47290@192.168.0.233:554/Streaming/channels/2
    front:
     -  rtsp://Admin:123456@192.168.0.44/stream1?username=admin&password=E10ADC3949BA59ABBE56E057F20F883E
    Backyard:
     - rtsp://admin:123456@192.168.0.14/media/video2
    driveway:  
    -  rtsp://admin:123456@192.168.0.22/media/video2
    garage:
    - rtsp://admin:123456@192.168.0.23/media/video2

Relevant log output

2024-02-15 17:26:05.172119158  *************************************************************
2024-02-15 17:26:05.172120915  *************************************************************
2024-02-15 17:26:05.172122836  ***    Config Validation Errors                           ***
2024-02-15 17:26:05.172150685  *************************************************************
2024-02-15 17:26:05.172168697  1 validation error for FrigateConfig
2024-02-15 17:26:05.172170344  cameras -> front2 -> onvif -> autotracking -> movement_weights
2024-02-15 17:26:05.172171709    movement_weights must have exactly 5 floats (type=value_error)
2024-02-15 17:26:05.172894096  Traceback (most recent call last):
2024-02-15 17:26:05.172897552    File "/opt/frigate/frigate/app.py", line 645, in start
2024-02-15 17:26:05.172899029      self.init_config()
2024-02-15 17:26:05.172900435    File "/opt/frigate/frigate/app.py", line 112, in init_config
2024-02-15 17:26:05.172901745      user_config = FrigateConfig.parse_file(config_file)
2024-02-15 17:26:05.172903077    File "/opt/frigate/frigate/config.py", line 1333, in parse_file
2024-02-15 17:26:05.172904270      return cls.parse_obj(config)
2024-02-15 17:26:05.172905571    File "pydantic/main.py", line 526, in pydantic.main.BaseModel.parse_obj
2024-02-15 17:26:05.172906882    File "pydantic/main.py", line 341, in pydantic.main.BaseModel.__init__
2024-02-15 17:26:05.172908563  pydantic.error_wrappers.ValidationError: 1 validation error for FrigateConfig
2024-02-15 17:26:05.172912457  cameras -> front2 -> onvif -> autotracking -> movement_weights
2024-02-15 17:26:05.172914868    movement_weights must have exactly 5 floats (type=value_error)
2024-02-15 17:26:05.173003398  
2024-02-15 17:26:05.173005983  *************************************************************
2024-02-15 17:26:05.173007923  ***    End Config Validation Errors                       ***
2024-02-15 17:26:05.173040481  *************************************************************
2024-02-15 17:26:06.423669121  [INFO] Service Frigate exited with code 1 (by signal 0)
s6-rc: info: service legacy-services: stopping
s6-rc: info: service legacy-services successfully stopped
s6-rc: info: service nginx: stopping
s6-rc: info: service go2rtc-healthcheck: stopping
2024-02-15 17:26:06.437166865  [INFO] The go2rtc-healthcheck service exited with code 256 (by signal 15)
s6-rc: info: service go2rtc-healthcheck successfully stopped
2024-02-15 17:26:06.521827088  [INFO] Service NGINX exited with code 0 (by signal 0)
s6-rc: info: service nginx successfully stopped
s6-rc: info: service nginx-log: stopping
s6-rc: info: service frigate: stopping
s6-rc: info: service frigate successfully stopped
s6-rc: info: service go2rtc: stopping
s6-rc: info: service frigate-log: stopping
s6-rc: info: service nginx-log successfully stopped
2024-02-15 17:26:06.524790837  exit with signal: terminated
s6-rc: info: service frigate-log successfully stopped
2024-02-15 17:26:06.530425757  [INFO] The go2rtc service exited with code 0 (by signal 0)
s6-rc: info: service go2rtc successfully stopped
s6-rc: info: service go2rtc-log: stopping
s6-rc: info: service go2rtc-log successfully stopped
s6-rc: info: service log-prepare: stopping
s6-rc: info: service s6rc-fdholder: stopping
s6-rc: info: service log-prepare successfully stopped
s6-rc: info: service legacy-cont-init: stopping
s6-rc: info: service s6rc-fdholder successfully stopped
s6-rc: info: service legacy-cont-init successfully stopped
s6-rc: info: service fix-attrs: stopping
s6-rc: info: service fix-attrs successfully stopped
s6-rc: info: service s6rc-oneshot-runner: stopping
s6-rc: info: service s6rc-oneshot-runner successfully stopped
s6-rc: info: service s6rc-fdholder: starting
s6-rc: info: service s6rc-oneshot-runner: starting
s6-rc: info: service s6rc-oneshot-runner successfully started
s6-rc: info: service fix-attrs: starting
s6-rc: info: service s6rc-fdholder successfully started
s6-rc: info: service fix-attrs successfully started
s6-rc: info: service legacy-cont-init: starting
s6-rc: info: service legacy-cont-init successfully started
s6-rc: info: service log-prepare: starting
s6-rc: info: service log-prepare successfully started
s6-rc: info: service nginx-log: starting
s6-rc: info: service go2rtc-log: starting
s6-rc: info: service frigate-log: starting
s6-rc: info: service nginx-log successfully started
s6-rc: info: service go2rtc-log successfully started
s6-rc: info: service go2rtc: starting
s6-rc: info: service frigate-log successfully started
s6-rc: info: service go2rtc successfully started
s6-rc: info: service go2rtc-healthcheck: starting
s6-rc: info: service frigate: starting
s6-rc: info: service go2rtc-healthcheck successfully started
s6-rc: info: service frigate successfully started
s6-rc: info: service nginx: starting
s6-rc: info: service nginx successfully started
s6-rc: info: service legacy-services: starting
2024-02-15 17:26:11.654089921  [INFO] Preparing Frigate...
2024-02-15 17:26:11.656469172  [INFO] Starting NGINX...
2024-02-15 17:26:11.658252382  [INFO] Preparing new go2rtc config...
s6-rc: info: service legacy-services successfully started
2024-02-15 17:26:11.670106129  [INFO] Starting Frigate...

FFprobe output from your camera

rtsp://admin:Foster47290@192.168.0.233:554

Frigate stats

No response

Operating system

Other Linux

Install method

Docker Compose

Coral version

USB

Network connection

Wired

Camera make and model

PTZIP204WX4IR

Any other information that may be helpful

No response

@NickM-27
Copy link
Sponsor Collaborator

You shouldn't be manually configuring movement weights. This is why frigate docs don't recommend copying the reference config

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants