blakeblackshear / frigate

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

[Camera Support]: Frigate 13 Beta 2 PTZ issue with Hikvision camera #7958

Closed sh0ckwavevr6 closed 1 year ago

sh0ckwavevr6 commented 1 year ago

Describe the problem you are having

Hi, I have installed the new beta and configured the object autotracking feature. I can control the PTZ and call presets using the interface

but when a target is identified, the cameras move to the detection and stops moving with this exception in the logs

2023-09-26 14:23:23.827838481 Exception in thread move_thread_PTZ_Roof: 2023-09-26 14:23:23.827943917 Traceback (most recent call last): 2023-09-26 14:23:23.828007477 File "/usr/lib/python3.9/threading.py", line 954, in _bootstrap_inner 2023-09-26 14:23:23.831246438 self.run() 2023-09-26 14:23:23.831449450 File "/usr/lib/python3.9/threading.py", line 892, in run 2023-09-26 14:23:23.832084336 self._target(*self._args, **self._kwargs) 2023-09-26 14:23:23.832154716 File "/opt/frigate/frigate/ptz/autotrack.py", line 237, in _process_move_queue 2023-09-26 14:23:23.832431351 self.onvif.get_camera_status(camera) 2023-09-26 14:23:23.832468648 File "/opt/frigate/frigate/ptz/onvif.py", line 359, in get_camera_status 2023-09-26 14:23:23.832748494 if status.MoveStatus.PanTilt == "IDLE" and status.MoveStatus.Zoom == "IDLE": 2023-09-26 14:23:23.832851232 AttributeError: 'NoneType' object has no attribute 'PanTilt' 2023-09-26 14:23:24.712562717 Exception in thread ptz_autotracker: 2023-09-26 14:23:24.712571543 Traceback (most recent call last): 2023-09-26 14:23:24.712573611 File "/usr/lib/python3.9/threading.py", line 954, in _bootstrap_inner 2023-09-26 14:23:24.713094848 self.run() 2023-09-26 14:23:24.713190971 File "/opt/frigate/frigate/ptz/autotrack.py", line 128, in run 2023-09-26 14:23:24.713471247 self.ptz_autotracker.camera_maintenance(camera_name) 2023-09-26 14:23:24.713546015 File "/opt/frigate/frigate/ptz/autotrack.py", line 399, in camera_maintenance 2023-09-26 14:23:24.714410313 self.onvif.get_camera_status(camera) 2023-09-26 14:23:24.714521002 File "/opt/frigate/frigate/ptz/onvif.py", line 359, in get_camera_status 2023-09-26 14:23:24.714761302 if status.MoveStatus.PanTilt == "IDLE" and status.MoveStatus.Zoom == "IDLE": 2023-09-26 14:23:24.714787563 AttributeError: 'NoneType' object has no attribute 'PanTilt'

Version

0.13.0-0858859

Frigate config file

detectors:
  coral:
    type: edgetpu
    device: pci:0
mqtt:
  # Required: host name
  host: 192.168.2.11
  # 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: SecureUser
  # Optional: password
  # NOTE: Environment variables that begin with 'FRIGATE_' may be referenced in {}.
  #       eg. password: '{FRIGATE_MQTT_PASSWORD}'
  password: SecurePassword
  # Optional: interval in seconds for publishing stats (default: shown below)
  stats_interval: 60
record: # how long to record before and after motion
    events:
        pre_capture: 5
        post_capture: 10

cameras:
  PTZ_Roof:
    ffmpeg:
      hwaccel_args: preset-vaapi
      inputs:
        - path: rtsp://admin:SecurePassword@192.168.50.200:554/Streaming/Channels/101/
          roles:
            - detect
            - record
    onvif:
        host: 192.168.50.200
        port: 80
        user: admin
        password: SecurePassword
        autotracking:
        # Optional: enable/disable object autotracking. (default: shown below)
          enabled: True
        # Optional: list of objects to track from labelmap.txt (default: shown below)
          track:
            - person
            - bike
            - dog
            - car
        # Required: Begin automatically tracking an object when it enters any of the listed zones.
          required_zones:
            - Rue
        # Required: Name of ONVIF preset in camera's firmware to return to when tracking is over. (default: shown below)
          return_preset: preset 1
        # Optional: Seconds to delay before returning to preset. (default: shown below)
          timeout: 10
    detect:
      width: 1920
      height: 1080
    record: # what you want Frigate to record
            enabled: True
           # retain: # uncomment this section if you want Frigate to record this camera 24/7. This can use a lot of space, you have been warned!
           #     days: 1
           #     mode: all
            events: # this is the default recording mode where events are recorded, the number of days it saves events for is 10.
                retain:
                    mode: active_objects
                    default: 30
    motion:
      mask:
       - 44,1080,776,1080,747,1004,47,1018
    snapshots:
            enabled: True
            retain:
                default: 30
    zones:  
      Rue:
        coordinates: 826,213,1314,155,1776,133,1869,224,1824,536,1195,1080,0,1049,0,508

    objects:
        track:
        - person
        - bike
        - dog
        - car

  Front_Door:
    ffmpeg:
      hwaccel_args: preset-vaapi
      inputs:
        - path: rtsp://admin:SecurePassword@192.168.50.201:554/Streaming/Channels/101/
          roles:
            - detect
            - record
    detect:
      width: 1920
      height: 1080
    record: # what you want Frigate to record
            enabled: True
           # retain: # uncomment this section if you want Frigate to record this camera 24/7. This can use a lot of space, you have been warned!
           #     days: 1
           #     mode: all
            events: # this is the default recording mode where events are recorded, the number of days it saves events for is 10.
                retain:   
                    mode: active_objects
                    default: 30
    zones:  
      Porch:
        coordinates: 1535,1080,541,1080,427,812,711,714,995,597,1369,446,1773,722
    motion:
        mask:
          - 1350,0,1138,0,1070,298,1350,312
          - 1920,117,1920,256,1734,126,1761,45  
          - 45,1023,795,1025,795,960,41,956

    objects:
      filters:
        dog:
          mask:
          - 1350,0,1138,0,1070,298,1350,312
        cat: 
          mask:
          - 1350,0,1138,0,1070,298,1350,312
        person:
          mask:
          - 1350,0,1138,0,1070,298,1350,312
        car:
          mask:
          - 1920,117,1920,256,1714,133,1761,45
      track:
        - person
        - dog
        - cat
        - car
        - bicycle  
    snapshots:
            enabled: True
            retain:
                default: 30
  Parking:
    ffmpeg:
      hwaccel_args: preset-vaapi
      inputs:
        - path: rtsp://admin:SecurePassword@192.168.50.203:554/Streaming/Channels/101/
          roles:
            - detect
            - record
    detect:
      width: 1920
      height: 1080
    record: # what you want Frigate to record
            enabled: True
           # retain: # uncomment this section if you want Frigate to record this camera 24/7. This can use a lot of space, you have been warned!
           #     days: 1
           #     mode: all
            events: # this is the default recording mode where events are recorded, the number of days it saves events for is 10.
                retain:
                    mode: active_objects
                    default: 30
    motion:
        mask:
          - 45,1080,795,1080,791,999,45,1015
    objects:
        track:
        - person
        - dog
        - cat
        - bicycle
    snapshots:
            enabled: True
            retain:
                default: 30
  Patio:
    ffmpeg:
      hwaccel_args: preset-vaapi
      inputs:
        - path: rtsp://admin:SecurePassword@192.168.50.208:554/Streaming/Channels/101/
          roles:
            - audio
            - detect
            - record    

    detect:
      width: 1920
      height: 1080
    record: # what you want Frigate to record
            enabled: True
           # retain: # uncomment this section if you want Frigate to record this camera 24/7. This can use a lot of space, you have been warned!
           #     days: 1
           #     mode: all
            events: # this is the default recording mode where events are recorded, the number of days it saves events for is 10.
                retain:
                    mode: active_objects
                    default: 30
    objects:
        track:
        - person
        - dog
        - cat

    audio:
      enabled: True
      listen:
        - bark
        - speech
        - yell

    snapshots:
            enabled: True
            retain:
                default: 30
  Back_Yard:
    ffmpeg:
      hwaccel_args: preset-vaapi
      inputs:
        - path: rtsp://admin:SecurePassword@192.168.50.207:554/Streaming/Channels/101/
          roles:
            - audio
            - detect
            - record

    detect:
      width: 1920
      height: 1080
    record: # what you want Frigate to record
            enabled: True
           # retain: # uncomment this section if you want Frigate to record this camera 24/7. This can use a lot of space, you have been warned!
           #     days: 1
           #     mode: all
            events: # this is the default recording mode where events are recorded, the number of days it saves events for is 10.
                retain:
                    mode: active_objects
                    default: 30
    objects:
        track:
        - person
        - dog
        - cat

    audio:
      enabled: True
      listen:
        - bark
        - speech
        - yell

    snapshots:
            enabled: True
            retain:
                default: 30

Relevant log output

2023-09-26 14:23:23.827838481  Exception in thread move_thread_PTZ_Roof:
2023-09-26 14:23:23.827943917  Traceback (most recent call last):
2023-09-26 14:23:23.828007477    File "/usr/lib/python3.9/threading.py", line 954, in _bootstrap_inner
2023-09-26 14:23:23.831246438      self.run()
2023-09-26 14:23:23.831449450    File "/usr/lib/python3.9/threading.py", line 892, in run
2023-09-26 14:23:23.832084336      self._target(*self._args, **self._kwargs)
2023-09-26 14:23:23.832154716    File "/opt/frigate/frigate/ptz/autotrack.py", line 237, in _process_move_queue
2023-09-26 14:23:23.832431351      self.onvif.get_camera_status(camera)
2023-09-26 14:23:23.832468648    File "/opt/frigate/frigate/ptz/onvif.py", line 359, in get_camera_status
2023-09-26 14:23:23.832748494      if status.MoveStatus.PanTilt == "IDLE" and status.MoveStatus.Zoom == "IDLE":
2023-09-26 14:23:23.832851232  AttributeError: 'NoneType' object has no attribute 'PanTilt'
2023-09-26 14:23:24.712562717  Exception in thread ptz_autotracker:
2023-09-26 14:23:24.712571543  Traceback (most recent call last):
2023-09-26 14:23:24.712573611    File "/usr/lib/python3.9/threading.py", line 954, in _bootstrap_inner
2023-09-26 14:23:24.713094848      self.run()
2023-09-26 14:23:24.713190971    File "/opt/frigate/frigate/ptz/autotrack.py", line 128, in run
2023-09-26 14:23:24.713471247      self.ptz_autotracker.camera_maintenance(camera_name)
2023-09-26 14:23:24.713546015    File "/opt/frigate/frigate/ptz/autotrack.py", line 399, in camera_maintenance
2023-09-26 14:23:24.714410313      self.onvif.get_camera_status(camera)
2023-09-26 14:23:24.714521002    File "/opt/frigate/frigate/ptz/onvif.py", line 359, in get_camera_status
2023-09-26 14:23:24.714761302      if status.MoveStatus.PanTilt == "IDLE" and status.MoveStatus.Zoom == "IDLE":
2023-09-26 14:23:24.714787563  AttributeError: 'NoneType' object has no attribute 'PanTilt'

FFprobe output from your camera

[{"return_code":0,"stderr":"","stdout":{"programs":[],"streams":[{"avg_frame_rate":"20/1","codec_long_name":"H.264/AVC/MPEG-4AVC/MPEG-4part10","height":1536,"width":2048}]}}]

Frigate stats

{"Back_Yard":{"camera_fps":5.1,"capture_pid":363,"detection_enabled":1,"detection_fps":46.2,"ffmpeg_pid":369,"pid":343,"process_fps":3.6,"skipped_fps":1.5},"Front_Door":{"camera_fps":5.1,"capture_pid":349,"detection_enabled":1,"detection_fps":10.4,"ffmpeg_pid":354,"pid":337,"process_fps":5.1,"skipped_fps":0.0},"PTZ_Roof":{"camera_fps":5.0,"capture_pid":345,"detection_enabled":1,"detection_fps":5.2,"ffmpeg_pid":350,"pid":336,"process_fps":5.1,"skipped_fps":0.0},"Parking":{"camera_fps":5.1,"capture_pid":353,"detection_enabled":1,"detection_fps":19.8,"ffmpeg_pid":360,"pid":339,"process_fps":5.1,"skipped_fps":0.0},"Patio":{"camera_fps":5.1,"capture_pid":358,"detection_enabled":1,"detection_fps":19.2,"ffmpeg_pid":365,"pid":341,"process_fps":5.0,"skipped_fps":0.0},"cpu_usages":{"1":{"cmdline":"/package/admin/s6/command/s6-svscan -d4 -- /run/service","cpu":"0.0","cpu_average":"0","mem":"0.0"},"15":{"cmdline":"s6-supervise s6-linux-init-shutdownd","cpu":"0.0","cpu_average":"0","mem":"0.0"},"16":{"cmdline":"/package/admin/s6-linux-init/command/s6-linux-init-shutdownd -c /run/s6/basedir -g 3000 -C -B","cpu":"0.0","cpu_average":"0","mem":"0.0"},"24":{"cmdline":"s6-supervise go2rtc-log","cpu":"0.0","cpu_average":"0","mem":"0.0"},"25":{"cmdline":"s6-supervise go2rtc","cpu":"0.0","cpu_average":"0","mem":"0.0"},"26":{"cmdline":"s6-supervise nginx-log","cpu":"0.0","cpu_average":"0","mem":"0.0"},"27":{"cmdline":"s6-supervise s6rc-oneshot-runner","cpu":"0.0","cpu_average":"0","mem":"0.0"},"28":{"cmdline":"s6-supervise go2rtc-healthcheck","cpu":"0.0","cpu_average":"0","mem":"0.0"},"29":{"cmdline":"s6-supervise nginx","cpu":"0.0","cpu_average":"0","mem":"0.0"},"30":{"cmdline":"s6-supervise frigate","cpu":"0.0","cpu_average":"0","mem":"0.0"},"31":{"cmdline":"s6-supervise frigate-log","cpu":"0.0","cpu_average":"0","mem":"0.0"},"32":{"cmdline":"s6-supervise s6rc-fdholder","cpu":"0.0","cpu_average":"0","mem":"0.0"},"41":{"cmdline":"/package/admin/s6-2.11.3.2/command/s6-fdholderd -1 -i data/rules","cpu":"0.0","cpu_average":"0","mem":"0.0"},"42":{"cmdline":"/package/admin/s6/command/s6-ipcserverd -1 -- /package/admin/s6/command/s6-ipcserver-access -v0 -E -l0 -i data/rules -- /package/admin/s6/command/s6-sudod -t 30000 -- /package/admin/s6-rc/command/s6-rc-oneshot-run -l ../.. --","cpu":"0.0","cpu_average":"0","mem":"0.0"},"80":{"cmdline":"s6-log -b -- T 1 n0 s10000000 T /dev/shm/logs/nginx","cpu":"0.3","cpu_average":"0","mem":"0.0"},"81":{"cmdline":"s6-log -b -- T 1 n0 s10000000 T /dev/shm/logs/go2rtc","cpu":"0.0","cpu_average":"0","mem":"0.0"},"82":{"cmdline":"s6-log -b -- T 1 n0 s10000000 T /dev/shm/logs/frigate","cpu":"0.0","cpu_average":"0","mem":"0.0"},"89":{"cmdline":"/usr/local/go2rtc/bin/go2rtc -config=/dev/shm/go2rtc.yaml","cpu":"0.0","cpu_average":"0","mem":"0.2"},"99":{"cmdline":"bash ./run.user go2rtc-healthcheck","cpu":"0.0","cpu_average":"0","mem":"0.0"},"109":{"cmdline":"python3 -u -m frigate","cpu":"14.3","cpu_average":"14","mem":"5.0"},"120":{"cmdline":"nginx: master process nginx","cpu":"0.0","cpu_average":"0","mem":"0.2"},"145":{"cmdline":"nginx: worker process","cpu":"0.0","cpu_average":"0","mem":"0.1"},"146":{"cmdline":"nginx: worker process","cpu":"0.0","cpu_average":"0","mem":"0.1"},"147":{"cmdline":"nginx: worker process","cpu":"0.0","cpu_average":"0","mem":"0.1"},"150":{"cmdline":"nginx: worker process","cpu":"0.0","cpu_average":"0","mem":"0.1"},"293":{"cmdline":"frigate.logger       ","cpu":"0.0","cpu_average":"0","mem":"1.3"},"295":{"cmdline":"frigate.recording_manager","cpu":"2.5","cpu_average":"7","mem":"2.2"},"304":{"cmdline":"/usr/bin/python3 -c from multiprocessing.resource_tracker import main;main(51)","cpu":"0.3","cpu_average":"0","mem":"0.1"},"305":{"cmdline":"frigate.detector.coral","cpu":"28.8","cpu_average":"25","mem":"2.0"},"318":{"cmdline":"frigate.output       ","cpu":"4.7","cpu_average":"4","mem":"1.9"},"320":{"cmdline":"ffmpeg -f rawvideo -pix_fmt yuv420p -video_size 1920x1080 -i pipe: -f mpegts -s 1280x720 -codec:v mpeg1video -q 8 -bf 0 pipe:","cpu":"7.4","cpu_average":"6","mem":"0.7"},"321":{"cmdline":"ffmpeg -f rawvideo -pix_fmt yuv420p -video_size 1920x1080 -i pipe: -f mpegts -s 1280x720 -codec:v mpeg1video -q 8 -bf 0 pipe:","cpu":"0.0","cpu_average":"0","mem":"0.2"},"322":{"cmdline":"ffmpeg -f rawvideo -pix_fmt yuv420p -video_size 1920x1080 -i pipe: -f mpegts -s 1280x720 -codec:v mpeg1video -q 8 -bf 0 pipe:","cpu":"0.0","cpu_average":"0","mem":"0.2"},"323":{"cmdline":"ffmpeg -f rawvideo -pix_fmt yuv420p -video_size 1920x1080 -i pipe: -f mpegts -s 1280x720 -codec:v mpeg1video -q 8 -bf 0 pipe:","cpu":"0.0","cpu_average":"0","mem":"0.2"},"324":{"cmdline":"ffmpeg -f rawvideo -pix_fmt yuv420p -video_size 1920x1080 -i pipe: -f mpegts -s 1280x720 -codec:v mpeg1video -q 8 -bf 0 pipe:","cpu":"0.0","cpu_average":"0","mem":"0.2"},"325":{"cmdline":"ffmpeg -f rawvideo -pix_fmt yuv420p -video_size 1280x720 -i pipe: -f mpegts -s 1280x720 -codec:v mpeg1video -q 8 -bf 0 pipe:","cpu":"0.0","cpu_average":"0","mem":"0.2"},"336":{"cmdline":"frigate.process:PTZ_Roof","cpu":"87.2","cpu_average":"85","mem":"2.4"},"337":{"cmdline":"frigate.process:Front_Door","cpu":"6.5","cpu_average":"4","mem":"2.0"},"339":{"cmdline":"frigate.process:Parking","cpu":"11.5","cpu_average":"9","mem":"2.1"},"341":{"cmdline":"frigate.process:Patio","cpu":"12.4","cpu_average":"8","mem":"2.0"},"343":{"cmdline":"frigate.process:Back_Yard","cpu":"25.7","cpu_average":"25","mem":"2.1"},"345":{"cmdline":"frigate.capture:PTZ_Roof","cpu":"3.4","cpu_average":"3","mem":"1.9"},"349":{"cmdline":"frigate.capture:Front_Door","cpu":"4.0","cpu_average":"3","mem":"1.9"},"350":{"cmdline":"ffmpeg -hide_banner -loglevel warning -threads 2 -hwaccel_flags allow_profile_mismatch -hwaccel vaapi -hwaccel_device /dev/dri/renderD128 -hwaccel_output_format vaapi -user_agent FFmpeg Frigate/0.13.0-0858859 -avoid_negative_ts make_zero -fflags +genpts+discardcorrupt -rtsp_transport tcp -timeout 5000000 -use_wallclock_as_timestamps 1 -i rtsp://admin:SecurePassword@192.168.50.200:554/Streaming/Channels/101/ -f segment -segment_time 10 -segment_format mp4 -reset_timestamps 1 -strftime 1 -c copy -an /tmp/cache/PTZ_Roof-%Y%m%d%H%M%S.mp4 -r 5 -vf fps=5,scale_vaapi=w=1920:h=1080,hwdownload,format=yuv420p -threads 2 -f rawvideo -pix_fmt yuv420p pipe:","cpu":"5.9","cpu_average":"5","mem":"0.9"},"353":{"cmdline":"frigate.capture:Parking","cpu":"3.7","cpu_average":"3","mem":"1.9"},"354":{"cmdline":"ffmpeg -hide_banner -loglevel warning -threads 2 -hwaccel_flags allow_profile_mismatch -hwaccel vaapi -hwaccel_device /dev/dri/renderD128 -hwaccel_output_format vaapi -user_agent FFmpeg Frigate/0.13.0-0858859 -avoid_negative_ts make_zero -fflags +genpts+discardcorrupt -rtsp_transport tcp -timeout 5000000 -use_wallclock_as_timestamps 1 -i rtsp://admin:SecurePassword@192.168.50.201:554/Streaming/Channels/101/ -f segment -segment_time 10 -segment_format mp4 -reset_timestamps 1 -strftime 1 -c copy -an /tmp/cache/Front_Door-%Y%m%d%H%M%S.mp4 -r 5 -vf fps=5,scale_vaapi=w=1920:h=1080,hwdownload,format=yuv420p -threads 2 -f rawvideo -pix_fmt yuv420p pipe:","cpu":"7.7","cpu_average":"7","mem":"0.8"},"358":{"cmdline":"frigate.capture:Patio","cpu":"3.4","cpu_average":"3","mem":"1.9"},"360":{"cmdline":"ffmpeg -hide_banner -loglevel warning -threads 2 -hwaccel_flags allow_profile_mismatch -hwaccel vaapi -hwaccel_device /dev/dri/renderD128 -hwaccel_output_format vaapi -user_agent FFmpeg Frigate/0.13.0-0858859 -avoid_negative_ts make_zero -fflags +genpts+discardcorrupt -rtsp_transport tcp -timeout 5000000 -use_wallclock_as_timestamps 1 -i rtsp://admin:SecurePassword@192.168.50.203:554/Streaming/Channels/101/ -f segment -segment_time 10 -segment_format mp4 -reset_timestamps 1 -strftime 1 -c copy -an /tmp/cache/Parking-%Y%m%d%H%M%S.mp4 -r 5 -vf fps=5,scale_vaapi=w=1920:h=1080,hwdownload,format=yuv420p -threads 2 -f rawvideo -pix_fmt yuv420p pipe:","cpu":"4.6","cpu_average":"4","mem":"0.8"},"363":{"cmdline":"frigate.capture:Back_Yard","cpu":"4.0","cpu_average":"3","mem":"1.9"},"365":{"cmdline":"ffmpeg -hide_banner -loglevel warning -threads 2 -hwaccel_flags allow_profile_mismatch -hwaccel vaapi -hwaccel_device /dev/dri/renderD128 -hwaccel_output_format vaapi -user_agent FFmpeg Frigate/0.13.0-0858859 -avoid_negative_ts make_zero -fflags +genpts+discardcorrupt -rtsp_transport tcp -timeout 5000000 -use_wallclock_as_timestamps 1 -i rtsp://admin:SecurePassword@192.168.50.208:554/Streaming/Channels/101/ -f segment -segment_time 10 -segment_format mp4 -reset_timestamps 1 -strftime 1 -c copy -an /tmp/cache/Patio-%Y%m%d%H%M%S.mp4 -r 5 -vf fps=5,scale_vaapi=w=1920:h=1080,hwdownload,format=yuv420p -threads 2 -f rawvideo -pix_fmt yuv420p pipe:","cpu":"6.2","cpu_average":"6","mem":"0.8"},"368":{"cmdline":"frigate.audio_manager","cpu":"2.5","cpu_average":"0","mem":"2.0"},"369":{"cmdline":"ffmpeg -hide_banner -loglevel warning -threads 2 -hwaccel_flags allow_profile_mismatch -hwaccel vaapi -hwaccel_device /dev/dri/renderD128 -hwaccel_output_format vaapi -user_agent FFmpeg Frigate/0.13.0-0858859 -avoid_negative_ts make_zero -fflags +genpts+discardcorrupt -rtsp_transport tcp -timeout 5000000 -use_wallclock_as_timestamps 1 -i rtsp://admin:SecurePassword@192.168.50.207:554/Streaming/Channels/101/ -f segment -segment_time 10 -segment_format mp4 -reset_timestamps 1 -strftime 1 -c copy -an /tmp/cache/Back_Yard-%Y%m%d%H%M%S.mp4 -r 5 -vf fps=5,scale_vaapi=w=1920:h=1080,hwdownload,format=yuv420p -threads 2 -f rawvideo -pix_fmt yuv420p pipe:","cpu":"7.7","cpu_average":"7","mem":"0.9"},"375":{"cmdline":"ffmpeg -hide_banner -loglevel warning -threads 2 -rtsp_transport tcp -timeout 5000000 -vn -i rtsp://admin:SecurePassword@192.168.50.208:554/Streaming/Channels/101/ -f s16le -ar 16000 -ac 1 -y pipe:","cpu":"2.2","cpu_average":"2","mem":"0.3"},"378":{"cmdline":"ffmpeg -hide_banner -loglevel warning -threads 2 -rtsp_transport tcp -timeout 5000000 -vn -i rtsp://admin:SecurePassword@192.168.50.207:554/Streaming/Channels/101/ -f s16le -ar 16000 -ac 1 -y pipe:","cpu":"2.8","cpu_average":"2","mem":"0.3"},"2115":{"cmdline":"sleep 30s","cpu":"0.0","cpu_average":"0","mem":"0.0"}},"detection_fps":100.8,"detectors":{"coral":{"detection_start":1695753221.368401,"inference_speed":8.98,"pid":305}},"gpu_usages":{"intel-vaapi":{"gpu":"7.52%","mem":"-%"}},"processes":{"audioDetector":{"pid":368},"go2rtc":{"pid":89},"logger":{"pid":293},"recording":{"pid":295}},"service":{"last_updated":1695753221,"latest_version":"0.12.1","storage":{"/dev/shm":{"free":223.6,"mount_type":"tmpfs","total":256.0,"used":32.4},"/media/frigate/clips":{"free":352383.9,"mount_type":"ext4","total":402075.4,"used":29195.6},"/media/frigate/recordings":{"free":352383.9,"mount_type":"ext4","total":402075.4,"used":29195.6},"/tmp/cache":{"free":929.4,"mount_type":"tmpfs","total":953.7,"used":24.3}},"temperatures":{"apex_0":62.55},"uptime":622,"version":"0.13.0-0858859"}}

Operating system

Proxmox

Install method

Docker Compose

Coral version

M.2

Network connection

Wired

Camera make and model

Hikvision DS-2DE3304W-DE Firmware: V5.5.71 build 180725

Any other information that may be helpful

No response

NickM-27 commented 1 year ago

This may be fixed by https://github.com/blakeblackshear/frigate/pull/7713

NickM-27 commented 1 year ago

CC @hawkeye217

hawkeye217 commented 1 year ago

@sh0ckwavevr6 Your camera might not support the ONVIF MoveStatus property:

5.3.7 GetStatus A PTZ-capable device shall be able to report its PTZ status through the GetStatus command. The PTZ status contains the following information: • Position (optional) – Specifies the absolute position of the PTZ unit together with the space references. The default absolute spaces of the corresponding PTZ configuration shall be referenced within the position element. This information shall be present if the device signals support via the capability StatusPosition. • MoveStatus (optional) – Indicates if the pan/tilt/zoom device unit is currently moving, idle or in an unknown state. This information shall be present if the device signals support via the capability MoveStatus. The state Unknown shall not be used during normal operation, but is reserved to initialization or error conditions.

https://www.onvif.org/onvif/specs/srv/ptz/ONVIF-PTZ-Service-Spec.pdf

Without this property, there's no way for the autotracking code to determine when your PTZ starts and stops moving.

Could you add this to your config:

logger:
  default: info
  logs:
    frigate.ptz.autotrack: debug
    frigate.ptz.onvif: debug

... then paste your log after restarting Frigate? The debug log should print all of the ONVIF capabilities of your camera on startup. Then we can see if there's a way to work around the issue.

sh0ckwavevr6 commented 1 year ago

@hawkeye217 See the logs below. I was under the impression that Hikvision was 100% ONVIF compilant... maybe the cameras is too old and doesn't support the latest revision

2023-09-26 14:52:08.429882561 [2023-09-26 14:52:08] frigate.ptz.onvif DEBUG : Onvif config for PTZ_Roof: { 2023-09-26 14:52:08.429887516 'Spaces': { 2023-09-26 14:52:08.429888925 'AbsolutePanTiltPositionSpace': [ 2023-09-26 14:52:08.429890122 { 2023-09-26 14:52:08.429891595 'URI': 'http://www.onvif.org/ver10/tptz/PanTiltSpaces/PositionGenericSpace', 2023-09-26 14:52:08.429895932 'XRange': { 2023-09-26 14:52:08.429897147 'Min': -1.0, 2023-09-26 14:52:08.429924981 'Max': 1.0 2023-09-26 14:52:08.429926407 }, 2023-09-26 14:52:08.429928355 'YRange': { 2023-09-26 14:52:08.429929518 'Min': -1.0, 2023-09-26 14:52:08.429930958 'Max': 1.0 2023-09-26 14:52:08.429932085 } 2023-09-26 14:52:08.429933633 } 2023-09-26 14:52:08.429934710 ], 2023-09-26 14:52:08.429935954 'AbsoluteZoomPositionSpace': [ 2023-09-26 14:52:08.429965757 { 2023-09-26 14:52:08.429967445 'URI': 'http://www.onvif.org/ver10/tptz/ZoomSpaces/PositionGenericSpace', 2023-09-26 14:52:08.429983663 'XRange': { 2023-09-26 14:52:08.429985152 'Min': 0.0, 2023-09-26 14:52:08.429986282 'Max': 1.0 2023-09-26 14:52:08.429987503 } 2023-09-26 14:52:08.429988556 } 2023-09-26 14:52:08.429989600 ], 2023-09-26 14:52:08.429990812 'RelativePanTiltTranslationSpace': [ 2023-09-26 14:52:08.429991983 { 2023-09-26 14:52:08.429993403 'URI': 'http://www.onvif.org/ver10/tptz/PanTiltSpaces/TranslationGenericSpace', 2023-09-26 14:52:08.429994530 'XRange': { 2023-09-26 14:52:08.430009797 'Min': -1.0, 2023-09-26 14:52:08.430011205 'Max': 1.0 2023-09-26 14:52:08.430012266 }, 2023-09-26 14:52:08.430013383 'YRange': { 2023-09-26 14:52:08.430014524 'Min': -1.0, 2023-09-26 14:52:08.430015808 'Max': 1.0 2023-09-26 14:52:08.430016916 } 2023-09-26 14:52:08.430017983 }, 2023-09-26 14:52:08.430019086 { 2023-09-26 14:52:08.430020542 'URI': 'http://www.onvif.org/ver10/tptz/PanTiltSpaces/TranslationSpaceFov', 2023-09-26 14:52:08.430041159 'XRange': { 2023-09-26 14:52:08.430042602 'Min': -1.0, 2023-09-26 14:52:08.430043728 'Max': 1.0 2023-09-26 14:52:08.430044802 }, 2023-09-26 14:52:08.430045937 'YRange': { 2023-09-26 14:52:08.430047059 'Min': -1.0, 2023-09-26 14:52:08.430048384 'Max': 1.0 2023-09-26 14:52:08.430049459 } 2023-09-26 14:52:08.430050516 } 2023-09-26 14:52:08.430051543 ], 2023-09-26 14:52:08.430052707 'RelativeZoomTranslationSpace': [ 2023-09-26 14:52:08.430053752 { 2023-09-26 14:52:08.430055119 'URI': 'http://www.onvif.org/ver10/tptz/ZoomSpaces/TranslationGenericSpace', 2023-09-26 14:52:08.430056323 'XRange': { 2023-09-26 14:52:08.430057506 'Min': -1.0, 2023-09-26 14:52:08.430058675 'Max': 1.0 2023-09-26 14:52:08.430059755 } 2023-09-26 14:52:08.430060830 } 2023-09-26 14:52:08.430061839 ], 2023-09-26 14:52:08.430063053 'ContinuousPanTiltVelocitySpace': [ 2023-09-26 14:52:08.430064082 { 2023-09-26 14:52:08.430086901 'URI': 'http://www.onvif.org/ver10/tptz/PanTiltSpaces/VelocityGenericSpace', 2023-09-26 14:52:08.430088321 'XRange': { 2023-09-26 14:52:08.430089436 'Min': -1.0, 2023-09-26 14:52:08.430090563 'Max': 1.0 2023-09-26 14:52:08.430091623 }, 2023-09-26 14:52:08.430092749 'YRange': { 2023-09-26 14:52:08.430093892 'Min': -1.0, 2023-09-26 14:52:08.430095163 'Max': 1.0 2023-09-26 14:52:08.430096203 } 2023-09-26 14:52:08.430097249 }, 2023-09-26 14:52:08.430098301 { 2023-09-26 14:52:08.430099670 'URI': 'http://www.onvif.org/ver10/tptz/PanTiltSpaces/VelocitySpaceFOV', 2023-09-26 14:52:08.430100780 'XRange': { 2023-09-26 14:52:08.430101914 'Min': -7.0, 2023-09-26 14:52:08.430103038 'Max': 7.0 2023-09-26 14:52:08.430104107 }, 2023-09-26 14:52:08.430108027 'YRange': { 2023-09-26 14:52:08.430109238 'Min': -7.0, 2023-09-26 14:52:08.430110349 'Max': 7.0 2023-09-26 14:52:08.430111400 } 2023-09-26 14:52:08.430112442 } 2023-09-26 14:52:08.430113477 ], 2023-09-26 14:52:08.430114643 'ContinuousZoomVelocitySpace': [ 2023-09-26 14:52:08.430115687 { 2023-09-26 14:52:08.430117046 'URI': 'http://www.onvif.org/ver10/tptz/ZoomSpaces/VelocityGenericSpace', 2023-09-26 14:52:08.430118147 'XRange': { 2023-09-26 14:52:08.430141190 'Min': -1.0, 2023-09-26 14:52:08.430142630 'Max': 1.0 2023-09-26 14:52:08.430143688 } 2023-09-26 14:52:08.430144741 }, 2023-09-26 14:52:08.430145801 { 2023-09-26 14:52:08.430147178 'URI': 'http://www.onvif.org/ver10/tptz/ZoomSpaces/VelocitySpaceMillimeter', 2023-09-26 14:52:08.430148260 'XRange': { 2023-09-26 14:52:08.430149400 'Min': -7.0, 2023-09-26 14:52:08.430150522 'Max': 7.0 2023-09-26 14:52:08.430151576 } 2023-09-26 14:52:08.430152630 } 2023-09-26 14:52:08.430153650 ], 2023-09-26 14:52:08.430154943 'PanTiltSpeedSpace': [ 2023-09-26 14:52:08.430155988 { 2023-09-26 14:52:08.430157337 'URI': 'http://www.onvif.org/ver10/tptz/PanTiltSpaces/GenericSpeedSpace', 2023-09-26 14:52:08.430158454 'XRange': { 2023-09-26 14:52:08.430159563 'Min': 0.0, 2023-09-26 14:52:08.430160708 'Max': 1.0 2023-09-26 14:52:08.430161781 } 2023-09-26 14:52:08.430162828 } 2023-09-26 14:52:08.430163891 ], 2023-09-26 14:52:08.430164974 'ZoomSpeedSpace': [ 2023-09-26 14:52:08.430166021 { 2023-09-26 14:52:08.430167382 'URI': 'http://www.onvif.org/ver10/tptz/ZoomSpaces/ZoomGenericSpeedSpace', 2023-09-26 14:52:08.430168601 'XRange': { 2023-09-26 14:52:08.430169758 'Min': 0.0, 2023-09-26 14:52:08.430170897 'Max': 1.0 2023-09-26 14:52:08.430171940 } 2023-09-26 14:52:08.430172994 } 2023-09-26 14:52:08.430174017 ], 2023-09-26 14:52:08.430175137 'Extension': None, 2023-09-26 14:52:08.430176222 '_attr_1': None 2023-09-26 14:52:08.430177277 }, 2023-09-26 14:52:08.430178363 'PTZTimeout': { 2023-09-26 14:52:08.430179556 'Min': datetime.timedelta(seconds=1), 2023-09-26 14:52:08.430180718 'Max': datetime.timedelta(seconds=600) 2023-09-26 14:52:08.430181733 }, 2023-09-26 14:52:08.430182838 '_value_1': None, 2023-09-26 14:52:08.430183951 'PTControlDirection': None, 2023-09-26 14:52:08.430185049 'Extension': None, 2023-09-26 14:52:08.430215272 '_attr_1': None 2023-09-26 14:52:08.430216591 }

NickM-27 commented 1 year ago

Might be worth seeing if newer firmware is available

hawkeye217 commented 1 year ago

@sh0ckwavevr6 Thanks. I still need a bit more info from the camera.

Can you grab the code from this gist, uncomment lines 38-47, and then run it and paste the output here?

hawkeye217 commented 1 year ago

The suggestion from @NickM-27 to check for new firmware is good as well. Technically the ONVIF spec says that the MoveStatus parameter is optional, and it looks like your camera already implements a lot of PTZ movement options. I'm just surprised that it doesn't report MoveStatus like the other cams I've tested.

sh0ckwavevr6 commented 1 year ago

@hawkeye217 It's a Grey market camera, i was advised to not mess with the firmware otherwise it might brick the device. the PTZ is installed on the rooftop so it's not easy to access. i'm not a fan of heights lol

At first I got this when I ran the script

Traceback (most recent call last): File "/tmp/fovtest.py", line 9, in mycam = ONVIFCamera('192.168.50.200', 80, 'admin', 'SecurePassword', '/etc/onvif/wsdl/') ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/usr/local/lib/python3.11/dist-packages/onvif/client.py", line 216, in init self.update_xaddrs() File "/usr/local/lib/python3.11/dist-packages/onvif/client.py", line 223, in update_xaddrs self.devicemgmt = self.create_devicemgmt_service() ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/usr/local/lib/python3.11/dist-packages/onvif/client.py", line 333, in create_devicemgmt_service return self.create_onvif_service('devicemgmt', from_template) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/usr/local/lib/python3.11/dist-packages/onvif/client.py", line 312, in create_onvif_service xaddr, wsdl_file, binding_name = self.get_definition(name, portType) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/usr/local/lib/python3.11/dist-packages/onvif/client.py", line 292, in get_definition raise ONVIFError('No such file: %s' % wsdlpath) onvif.exceptions.ONVIFError: Unknown error: No such file: /etc/onvif/wsdl/devicemgmt.wsdl

So I have created the folder /etc/onvif/wsdl and copied the data from /usr/local/lib/python/site-packages/wsdl

then it gave me this

Connected to ONVIF camera Created media service object Creating PTZ object Created PTZ service object PTZ service capabilities: { '_value_1': None, 'EFlip': False, 'Reverse': False, 'GetCompatibleConfigurations': True, '_attr_1': { 'MoveStatus': 'false', 'StatusPosition': 'true' } }

PTZ status: { 'Position': { 'PanTilt': { 'x': -0.880278, 'y': 0.021778, 'space': 'http://www.onvif.org/ver10/tptz/PanTiltSpaces/PositionGenericSpace' }, 'Zoom': { 'x': 0.0, 'space': 'http://www.onvif.org/ver10/tptz/ZoomSpaces/PositionGenericSpace' } }, 'MoveStatus': None, 'Error': 'NO error', 'UtcTime': datetime.datetime(2023, 9, 27, 1, 16, 53, tzinfo=<isodate.tzinfo.Utc object at 0x7f9b0b7a0bd0>), '_value_1': None, '_attr_1': None } YES - RelativeMove Pan/Tilt (FOV) is supported. YES - RelativeMove Zoom is supported.

Let's see if creating /etc/onvif/wsdl fixed my issues! I'm waiting for movements

sh0ckwavevr6 commented 1 year ago

Let's see if creating /etc/onvif/wsdl fixed my issues! I'm waiting for movements

Ok forget it I wasn't running the script inside the docker lol I retested and same error

hawkeye217 commented 1 year ago

Gotcha. Thanks for that!

Since it's a gray market camera, I bet the ONVIF implementation in firmware might not be totally up to standard.

You'll see the line near the top of the output:

'MoveStatus': 'false'

This means your camera's firmware doesn't have the capability of reporting the status of the PTZ motor via ONVIF. The other PTZs I've tested in implementing the autotracking feature have shown this as true.

The current implementation of the autotracker in Frigate uses MoveStatus to know when your PTZ motor has started or stopped. So this means you won't be able to use autotracking for now. Alternative ways of determining movement might be possible, but I don't plan to do anything for this version, at least.

I'll make some code changes in https://github.com/blakeblackshear/frigate/pull/7713 to ensure autotracking works only with PTZs that report MoveStatus: 'true'.

sh0ckwavevr6 commented 1 year ago

Oh I see! I'm gonna need to get a new camera.. thanks for taking the time! awesome work by the way! do you have any recommendation

Alternative ways of determining movement might be possible, but I don't plan to do anything for this version, at least.

If you need a beta tester for future revision let me know! :)

NickM-27 commented 1 year ago

Closing this as the behavior is working as expected given the capability is not supported. Feel free to continue conversation or create a new issue if something else comes up

kyle4269 commented 1 year ago

Oh I see! I'm gonna need to get a new camera.. thanks for taking the time! awesome work by the way! do you have any recommendation

Alternative ways of determining movement might be possible, but I don't plan to do anything for this version, at least.

If you need a beta tester for future revision let me know! :)

I was in the same boat as you. No MoveStatus was detected on my camera and threw the same errors in the logs.

I did a TON of research on how to update my camera properly. My model is DS-2DE4A220IW-DE and was on V5.5.71 build 180725

I followed the guide here. Both our PTZs are in the R7 family. I started with V5.5.8 and still didn't have MoveStatus. Next I went to V5.6.11 and MoveStatus now shows PanTilt and Zoom. I stopped there not wanting to push my luck any further upgrading the firmware more.

Do this at your own risk.

kyle4269 commented 1 year ago

@sh0ckwavevr6 Were you ever able to get autotrack to work?

sh0ckwavevr6 commented 1 year ago

@kyle4269 not really. I bite the bullet and successfully upgraded the firmware to V5.6.18 build 210428

Now when I run the fovtest.py I got this

'MoveStatus': {
    'PanTilt': 'MOVING',
    'Zoom': 'IDLE'
},
'Error': 'NO error',
'UtcTime': datetime.datetime

YES - RelativeMove Pan/Tilt (FOV) is supported. YES - RelativeMove Zoom is supported

frigate was able to figure out the "movement_weights" variable.

but when something is detected. the camera move once and get stuck there...

the log is filled with the following

2023-10-01 19:37:04.880447079 [2023-10-01 19:37:04] frigate.ptz.autotrack DEBUG : Motion estimator transformation: [[ 711.07922186 -638.44795629]] 2023-10-01 19:37:04.923727807 [2023-10-01 19:37:04] frigate.ptz.autotrack DEBUG : Motion estimator running for PTZ_Roof - frame time: 1696203424.840408, 1696172580.853788, 0.0

until I move the PTZ with the web interface then the log show

2023-10-01 19:43:30.997313202 [2023-10-01 19:43:30] frigate.ptz.autotrack DEBUG : Autotrack: Time is 1696203810.849772, returning to preset: Preset 1 2023-10-01 19:43:31.022965774 [2023-10-01 19:43:31] frigate.ptz.autotrack DEBUG : Predicted movement time: 0.002218312332945891 2023-10-01 19:43:31.023065837 [2023-10-01 19:43:31] frigate.ptz.autotrack DEBUG : Actual movement time: 31229.995984077454 2023-10-01 19:43:31.023155823 [2023-10-01 19:43:31] frigate.ptz.autotrack DEBUG : Adding new values to move metrics 2023-10-01 19:43:31.063439178 [2023-10-01 19:43:31] frigate.ptz.autotrack DEBUG : Motion estimator transformation: [[ 593.42795518 -602.49115855]] 2023-10-01 19:43:31.067142898 [2023-10-01 19:43:31] frigate.ptz.autotrack DEBUG : Motion estimator reset - homography 2023-10-01 19:43:32.006751752 [2023-10-01 19:43:32] frigate.ptz.autotrack DEBUG : Running camera maintenance 2023-10-01 19:43:33.006989803 [2023-10-01 19:43:33] frigate.ptz.autotrack DEBUG : Running camera maintenance 2023-10-01 19:43:34.007469571 [2023-10-01 19:43:34] frigate.ptz.autotrack DEBUG : Running camera maintenance 2023-10-01 19:43:35.008118826 [2023-10-01 19:43:35] frigate.ptz.autotrack DEBUG : Running camera maintenance 2023-10-01 19:43:36.008564902 [2023-10-01 19:43:36] frigate.ptz.autotrack DEBUG : Running camera maintenance

When the cameras is moved, Frigate get it back to his "home" position at P000 T00 until a new target is discovered...

it never zoom just move toward the target and get stuck there... I Updated frigate to 0.13.0-9a4f970

hawkeye217 commented 1 year ago

@sh0ckwavevr6 Check out the replies I gave to @kyle4269 here.

sh0ckwavevr6 commented 1 year ago

@hawkeye217 well looks like it's time for me to get a new PTZ camera ! the firmware V5.6.18 is the latest available for my Hikvision DS-2DE3304W-DE I don't think this camera will get a new firmware.

thanks for your time! if you think of a workaround to bypass this issue let me know! ;)

kyle4269 commented 1 year ago

@sh0ckwavevr6 After trying everything I know possible, it seems Hikvision is the issue. So I decided to purchase a new PTZ.. Went with a Dahua which seems to be the most compatible. Good luck!