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.
Gilley7997
Posts: 6
Joined: Sun Apr 02, 2017 5:36 pm

Re: Amcrest PTZ functionality

Post by Gilley7997 » Mon Apr 03, 2017 3:19 am

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 2628 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.

Gilley7997
Posts: 6
Joined: Sun Apr 02, 2017 5:36 pm

Re: Amcrest PTZ functionality

Post by Gilley7997 » Mon Apr 03, 2017 4:35 am

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 2627 times
so actually getting a request in and accepted but not consistantly. Just doesn't make any sense.

alabamatoy
Posts: 96
Joined: Sun Jun 05, 2016 2:53 pm

Re: Amcrest PTZ functionality

Post by alabamatoy » Mon Apr 03, 2017 12:26 pm

Amcrest has a support forum, and they do respond...

VladSI
Posts: 7
Joined: Mon May 01, 2017 9:33 pm

Re: Amcrest PTZ functionality

Post by VladSI » Mon May 01, 2017 9:41 pm

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.

VladSI
Posts: 7
Joined: Mon May 01, 2017 9:33 pm

Re: Amcrest PTZ functionality

Post by VladSI » Tue May 02, 2017 11:25 pm

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)
Last edited by VladSI on Wed May 03, 2017 11:56 pm, edited 1 time in total.

User avatar
iconnor
Posts: 369
Joined: Fri Oct 29, 2010 1:43 am
Location: Toronto
Contact:

Re: Amcrest PTZ functionality

Post by iconnor » Wed May 03, 2017 12:09 pm

What's with the double & in there ?

VladSI
Posts: 7
Joined: Mon May 01, 2017 9:33 pm

Re: Amcrest PTZ functionality

Post by VladSI » Wed May 03, 2017 11:57 pm

I copy and pasted the cmd line from the preset method which also had that extra "&". It works both ways but code edited regardless.

Gilley7997
Posts: 6
Joined: Sun Apr 02, 2017 5:36 pm

Re: Amcrest PTZ functionality

Post by Gilley7997 » 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!

VladSI
Posts: 7
Joined: Mon May 01, 2017 9:33 pm

Re: Amcrest PTZ functionality

Post by VladSI » Fri Jun 23, 2017 6:39 pm

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.

VladSI
Posts: 7
Joined: Mon May 01, 2017 9:33 pm

Re: Amcrest PTZ functionality

Post by VladSI » Fri Jun 23, 2017 6:41 pm

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?

Gilley7997
Posts: 6
Joined: Sun Apr 02, 2017 5:36 pm

Re: Amcrest PTZ functionality

Post by Gilley7997 » Sat Jun 24, 2017 6:15 pm

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

kevins7189
Posts: 1
Joined: Tue Sep 26, 2017 1:01 am

Re: Amcrest PTZ functionality

Post by kevins7189 » Tue Sep 26, 2017 1:07 am

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?

VladSI
Posts: 7
Joined: Mon May 01, 2017 9:33 pm

Re: Amcrest PTZ functionality

Post by VladSI » Tue Sep 26, 2017 12:39 pm

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.....".

Post Reply

Who is online

Users browsing this forum: No registered users and 3 guests