Amcrest PTZ functionality

If you've made a patch to quick fix a bug or to add a new feature not yet in the main tree then post it here so others can try it out.
alabamatoy
Posts: 349
Joined: Sun Jun 05, 2016 2:53 pm

Re: Amcrest PTZ functionality

Post by alabamatoy »

All of this discussion of the type of authentication is interesting, but I am inclined to think its a Zoneminder version or operating system issue, not an issue with the Amcrest cameras themselves....despite the evidence to the contrary. Why would all this work so nicely on mine and fail on others? I have a brand new Amcrest POE PTZ camera that I added to my setup just a few weeks ago, and it works fine with my original script.

I dont object to someone finding flaws in my ugly, probably-poorly designed script. But I am fearful that people are chasing the wrong root cause of the problem because it works fine on my setup, and has been for months. Is there a flaw in this thinking?
simonlok
Posts: 3
Joined: Fri Feb 23, 2018 1:05 pm

Re: Amcrest PTZ functionality

Post by simonlok »

Which model of camera and which firmware version are you running?

This is what I have:

Software Version2.520.AC00.18.R, Build Date: 2017-06-29
WEB Version3.2.1.453504
ONVIF Version2.42 (V2.2.2.428697)

On the version of software stated above the CGI PTZ API reports 401 Unauthorized to all HTTP Basic authentication requests.

Based on my reading of the Amcrest support forum they removed support for HTTP Basic and require HTTP Digest authentication in their recent firmware.
alabamatoy
Posts: 349
Joined: Sun Jun 05, 2016 2:53 pm

Re: Amcrest PTZ functionality

Post by alabamatoy »

Isnt this controlled by CURL? Is not CURL what the script is using to commo with the camera?

I cannot tell you the details of the camera unless there is some way to get that remotely - I am about 120 miles from my cameras!
alabamatoy
Posts: 349
Joined: Sun Jun 05, 2016 2:53 pm

Re: Amcrest PTZ functionality

Post by alabamatoy »

Cross-posting, another user seems to have figured out a fix: viewtopic.php?f=36&t=27093#p105188
alabamatoy
Posts: 349
Joined: Sun Jun 05, 2016 2:53 pm

Re: Amcrest PTZ functionality

Post by alabamatoy »

iconnor wrote: Tue Jan 10, 2017 2:14 pm Hey alabamatoy, can I assist you in getting this into ZoneMinder?

Do you have plans to do so, or can I just grab the script and make a PR in your name?
This code apparently never made it into the repo. My new 1.32.3 install has no amcrest control scripts. Oh well, I know yall got a lot going on.
bhearsum
Posts: 3
Joined: Thu Jan 02, 2020 6:43 pm

Re: Amcrest PTZ functionality

Post by bhearsum »

Cross posting from viewtopic.php?f=36&t=27093&p=112998#p112998:

Thanks to everyone who's been working on this so far. I've been able to get this working with 1.32.3 + the latest firmware on my IP2M-841. However, it appears that Zoneminder 1.32.3's frontend is not sending the right query parameters when making PTZ requests. For example, it posts to /zm/index.php with paramaters such as:
view=request
request=control
id=6
control=Up
yge=32
Which results in errors like "Invalid control parameter: Up" and "Can't access Up member of object of class ZoneMinder::Control::Amcrest_HTTP".

Changing those requests to send "moveUp" (which matches the method name in Amcrest_HTTP.pm) fixes the problem.

I also tried adjusting the perl module to use "Up", but that failed because the PHP backend doesn't like "Up" as a control parameter (see https://github.com/ZoneMinder/zoneminde ... ns.php#L11)
User avatar
iconnor
Posts: 2879
Joined: Fri Oct 29, 2010 1:43 am
Location: Toronto
Contact:

Re: Amcrest PTZ functionality

Post by iconnor »

You need to check Can Move Continuous.
NoNaym
Posts: 6
Joined: Sun Jan 26, 2020 5:37 am

Re: Amcrest PTZ functionality

Post by NoNaym »

Just picked up an Amcrest IP3M-941 and am seeing the same "Invalid control parameter: Up" and "Can't access Up member of object of class ZoneMinder::Control::Amcrest_HTTP" errors. Punching the URLs from the amcrest781.pm/Amcrest_HTTP.pm files with my camera's IP makes the camera move correctly, so it definitely seems like it should work. I have tried checking "Can Move Continuous," but I get a "No printMsg method defined for protocol ZoneMinder::Control" error instead. Not sure if anybody is using this specific Amcrest camera with ZM PTZ control yet, but would definitely appreciate any thoughts. Seemed like the right place to post this, but definitely let me know if I'm wrong there.

I have made sure that my serial number is in the Device Control section and all credentials and ip addresses are correct.

Camera firmware version is latest: V2.620.00AC00.3.R

Thanks in advance!!
alabamatoy
Posts: 349
Joined: Sun Jun 05, 2016 2:53 pm

Re: Amcrest PTZ functionality

Post by alabamatoy »

What version of ZM?
NoNaym
Posts: 6
Joined: Sun Jan 26, 2020 5:37 am

Re: Amcrest PTZ functionality

Post by NoNaym »

ZM v1.32.3 (manually pulled Amcrest_HTTP.pm from github)
alabamatoy
Posts: 349
Joined: Sun Jun 05, 2016 2:53 pm

Re: Amcrest PTZ functionality

Post by alabamatoy »

NoNaym wrote: Sun Jan 26, 2020 3:39 pm ZM v1.32.3 (manually pulled Amcrest_HTTP.pm from github)
I have been unable to get this new Amcrest script to work with my 1.32.3, but I am getting a different error than you. I think Im going to upgrade to 1.34.1 and see how it works. My understanding is that 1.32.3 to 1.34.X is a pretty seamless upgrade....but I haven't done it yet.
NoNaym
Posts: 6
Joined: Sun Jan 26, 2020 5:37 am

Re: Amcrest PTZ functionality

Post by NoNaym »

Testing ZM v1.34.0 now... Unfortunately I am now getting:

Code: Select all

Camera control command FAILED: '401 Unauthorized' for URL user:pass@host/cgi-bin/ptz.cgi?action=stop&code=Right&channel=0&arg1=0&arg2=1&arg3=0
Tried a few different variations of the control address (i.e. with and w/o "http://" and ":80"). Haven't tried much else yet...

Again, copying the URL directly from the ZM log and entering into web browser causes camera to move, so I'm still pretty puzzled.
alabamatoy
Posts: 349
Joined: Sun Jun 05, 2016 2:53 pm

Re: Amcrest PTZ functionality

Post by alabamatoy »

I believe the control address is supposed to be "login:password@ip_address:port" and the control device is supposed to be the serial number of the camera.
NoNaym
Posts: 6
Joined: Sun Jan 26, 2020 5:37 am

Re: Amcrest PTZ functionality

Post by NoNaym »

alabamatoy wrote: Sun Jan 26, 2020 7:34 pm I believe the control address is supposed to be "login:password@ip_address:port" and the control device is supposed to be the serial number of the camera.
Yup, I've tried just about every possible combination with these details entered and not.

Adding the port to the URL has not made a difference fore me, and results in the exact same 401 error (this is as I would expect it to behave, as http implies port 80 - unless you are using a custom port on your camera).

And it actually looks like having the serial number in the Device Control section does not make a difference either (same 401 error, not quite what I was expecting).
alabamatoy
Posts: 349
Joined: Sun Jun 05, 2016 2:53 pm

Re: Amcrest PTZ functionality

Post by alabamatoy »

NoNaym wrote: Sun Jan 26, 2020 7:01 pm Testing ZM v1.34.0 now... Unfortunately I am now getting:

Code: Select all

Camera control command FAILED: '401 Unauthorized' for URL user:pass@host/cgi-bin/ptz.cgi?action=stop&code=Right&channel=0&arg1=0&arg2=1&arg3=0
I upgraded to 1.34.1 and using the new "Amcrest HTTP API" control I am getting the same error as you. I have no means of testing directly with a browser pointed at the camera.

This discussion should probably be moved to the 1.34 forum.
Post Reply