Closed sh0ckwavevr6 closed 1 year ago
This may be fixed by https://github.com/blakeblackshear/frigate/pull/7713
CC @hawkeye217
@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.
@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 }
Might be worth seeing if newer firmware is available
@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?
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.
@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
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
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'
.
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! :)
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
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.
@sh0ckwavevr6 Were you ever able to get autotrack to work?
@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
@sh0ckwavevr6 Check out the replies I gave to @kyle4269 here.
@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! ;)
@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!
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
Version
0.13.0-0858859
Frigate config file
Relevant log output
FFprobe output from your camera
Frigate stats
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