Page 2 of 4

Re: Amcrest PTZ functionality

Posted: Mon Apr 03, 2017 3:19 am
by Gilley7997
I took this a bit further and verified the base64 encoding of the authentication that is sent to the camera for the Basic Authentication, and that is also correct in the wireshark capture.

What I did find that was odd was the 410 authorization Failure return from the Camera appears to be processing the Authorization as a Digest Authorization rather than a Basic as the return packet from the Camera shows this:
wireshark2.png
wireshark2.png (8.24 KiB) Viewed 17396 times
I am by no means an expert on Authorization, but according to the API Documentation this type of response should only be received if a Digest Authentication was attempted.

I guess at this point I am looking to confirm with anyone else who may have been using these scripts with this Camera and is running the same Firmware as I am, or anyone else who is smarter than me that can make sense out of this.

Re: Amcrest PTZ functionality

Posted: Mon Apr 03, 2017 4:35 am
by Gilley7997
Well I made a little more progress, and to me it's really looking like an issue in the firmware. I added the specific Digest Authorization Credentials to the script and I am now getting 50% success on the calls, unfortunately that means it' still garbage. This is now what my subroutine looks like:

Code: Select all

sub Right
{
    my $self = shift;
    Debug( "Move Right" );
    $self->{ua}->credentials("server:port","realm-from-wireshark","username"=>"password");
    $self->sendCmd( 'cgi-bin/ptz.cgi?action=start&code=Right&channel=0&arg1=0&arg2=1&arg3=0' );
    usleep (500);
    $self->sendCmd( 'cgi-bin/ptz.cgi?action=stop&code=Right&channel=0&arg1=0&arg2=1&arg3=0' );
}
I also removed the user credentials from the Control Address as I was specifically adding them to the script.

The Camera Moves but doesn't stop. You can see that in the logs here,
Logs.png
Logs.png (11.9 KiB) Viewed 17395 times
so actually getting a request in and accepted but not consistantly. Just doesn't make any sense.

Re: Amcrest PTZ functionality

Posted: Mon Apr 03, 2017 12:26 pm
by alabamatoy
Amcrest has a support forum, and they do respond...

Re: Amcrest PTZ functionality

Posted: Mon May 01, 2017 9:41 pm
by VladSI
Same issue with digest auth on an IP2M-841W with R17 firmware. I reverted to previous firmware version of R16 and problem solved. Found prior version via AWS S3 API calls listing their firmware directory. I can post a link if anyone needs it and doesn't know how to list S3.

Re: Amcrest PTZ functionality

Posted: Tue May 02, 2017 11:25 pm
by VladSI
Home function confirmed working for IP2M-841 R16 firmware:

Code: Select all

#Move Camera to Home Position
sub presetHome
{
    my $self = shift;
#    Debug( "Home Preset" );
    $self->sendCmd( 'cgi-bin/ptz.cgi?action=start&channel=0&code=PositionABS&arg1=180&arg2=0&arg3=1&arg4=1' );
}
(Updated 20170503 - removed extra "&" in command)

Re: Amcrest PTZ functionality

Posted: Wed May 03, 2017 12:09 pm
by iconnor
What's with the double & in there ?

Re: Amcrest PTZ functionality

Posted: Wed May 03, 2017 11:57 pm
by VladSI
I copy and pasted the cmd line from the preset method which also had that extra "&". It works both ways but code edited regardless.

Re: Amcrest PTZ functionality

Posted: Fri Jun 23, 2017 6:07 pm
by Gilley7997
Can you provide the Link to the Firmware? I know that they are telling me that It is not supported but Support has been less than helpful even specifically telling me that downgrading it not supported, but they are also basically ignoring the issue.

Thanks!

Re: Amcrest PTZ functionality

Posted: Fri Jun 23, 2017 6:39 pm
by VladSI
Gilley7997 wrote: Fri Jun 23, 2017 6:07 pm Can you provide the Link to the Firmware? I know that they are telling me that It is not supported but Support has been less than helpful even specifically telling me that downgrading it not supported, but they are also basically ignoring the issue.

Thanks!
https://s3.amazonaws.com/amcrest-files/ ... 160909.zip

This is for the IP2M-841. If you are looking for different model, let me know and I'll post the direct link for your camera.

Re: Amcrest PTZ functionality

Posted: Fri Jun 23, 2017 6:41 pm
by VladSI
By the way - looks like R18 is out. Changelog only mentions general bug fixes. Anyone want to be the guinea pig to see if auth was fixed?

Re: Amcrest PTZ functionality

Posted: Sat Jun 24, 2017 6:15 pm
by Gilley7997
Actually I already did. The issue is not resolved.

There is a thread that I was participating in on the Amcrest forums as well.

Here is the link there if anyone else would like to join in.

https://amcrest.com/forum/technical-dis ... 1-s10.html

Re: Amcrest PTZ functionality

Posted: Tue Sep 26, 2017 1:07 am
by kevins7189
Hi, new to zoneminder.
Using IP2-841, with R16 firmware. Zm v1.30.4
I am trying to use PTZ, I use Fedora, so the control script is in /usr/share/perl5/vendor_perl/Zoneminder/Control.
Got the control added, restarted zm, but when I send a command, I get
Invalid control parameter: Right /usr/share/zoneminder/www/includes/control_functions.php 282
Camera control command FAILED: '500 No Host option provided' for URL /cgi-bin/ptz.cgi?action=stop&code=Right&channel=0&arg1=0&arg2=1&arg3=0 zmcontrol.pl

What is that trying to tell me?

Re: Amcrest PTZ functionality

Posted: Tue Sep 26, 2017 12:39 pm
by VladSI
Did you fill out the "Control Address" box in the "Control" configuration panel? The URL is incomplete as it does not have the auth and host. It should look like "user:password@host/cgi-bin/ptx.cgi.....".

Re: Amcrest PTZ functionality

Posted: Sat Jan 20, 2018 8:39 am
by fiddletwix
I just bought an Amcrest camera and was excited to use this control script. I was disappointed that it didn't work and read just the first page of this thread to find someone else had the same issue but I didn't read the 2nd page where they figured out the digest authentication being the issue. So I spent a few hours figuring out the cause of the 401 error (I should have read the 2nd page) and rewriting the script to handle this method of authentication. This is working for this firmware: 2.420.AC00.18.R, Build Date: 2017-05-21 I want to do a little cleanup of code and will post the script here.

Re: Amcrest PTZ functionality

Posted: Fri Feb 23, 2018 1:09 pm
by simonlok
Would you be willing to share your script?

I am intersted in making the control work for my Amcrest cameras.