camera control help requested

Have some questions or having issues with your IP Camera(s), Post them here for the mods and other users to assist you with.
Post Reply
alabamatoy
Posts: 18
Joined: Thu Jul 07, 2016 5:10 pm

camera control help requested

Post by alabamatoy »

I have the HTTP API SDK document. I have pan and tilt working via HTTP using the info in this document. However, I am trying to implement positionabs, and I keep getting a response from the camera for "500 read timeout" for the following URL:

http://login:password@ip_address/cgi-bin/ptz.cgi?action=start&code=PositionABS&arg1=89&arg2=39&arg3=1

Obviously login, password and ip_address are enumerated in the actual call. Can you explain to me what is going wrong that's causing the "500 read timeout" response from the camera?
alabamatoy
Posts: 18
Joined: Thu Jul 07, 2016 5:10 pm

Re: camera control help requested

Post by alabamatoy »

The forum is truncating the URL, here is the text:
cgi-bin/ptz.cgi?action=start&code=PositionABS&arg1=89&arg2=39&arg3=1
User avatar
TheUberOverLord
Posts: 32
Joined: Sun Jul 31, 2016 5:14 pm

Re: camera control help requested

Post by TheUberOverLord »

Here is the correct syntax using a Preset name of 1. Please replace the required fields with your camera information:

Code: Select all


http://User:Password@ISPipAddressOrDDNS:Port/cgi-bin/ptz.cgi?action=start&channel=0&code=GotoPreset&arg1=0&arg2=1&arg3=0&arg4=0
Note: The above line is one contiguous line with no spaces. The Forum display is showing it as two lines. While this example is NOT using ABS positioning you can use it as a reference to proper syntax.

Live Real-Time working TOTALLY secure ("Never exposes any of your cameras information") example demonstrating using the above CGI command and many more CGI commands. Which is compatible with ANY and ALL Internet browser capable devices which are using ANY browsers, from Computers to Tablets to Phones and TV's and does not use or require any Plug-In's.

http://107.170.59.150/Amcrest/SecureIma ... ontrol.htm

Don
mrceolla
Posts: 5
Joined: Sun Mar 11, 2018 7:10 pm

Re: camera control help requested

Post by mrceolla »

The "user:password@" format doesn't appear to work for my Amcrest IP2M-841W.

I am trying to use the following URLs

http://username:[email protected]/cgi ... 2=1&arg3=0

http://username:[email protected]/cgi ... 2=2&arg3=0

These do not even work reliably in Firefox. Sometimes FF will still show the dialog for username and password. And my home automation scripting language, which supports "username:password@" for Foscam cameras, does not work with this Amcrest. I am getting very frustrated with this.

Are there no parameter names that I can use to pass the username and password, like "&user=username&pwd=password" or something?

Does the password in the "username:password@" format need to be encoded???

How do I pass credentials to ptz.cgi ??? Is there any other endpoint I can use to make the camera move to a PTZ preset?
mrceolla
Posts: 5
Joined: Sun Mar 11, 2018 7:10 pm

Re: camera control help requested

Post by mrceolla »

Well, I never got it to work with Basic Authentication. It appears ptz.cgi doesn't support it on this camera. I noticed that when Firefox did work with the username:password@ format, it reported that it was sending "Digest" Authorization headers. That's when I abandoned Basic.

Fortunately my home automation software, HomeSeer 3, allows me to use a number of languages to write custom scripts. Here is what I wrote to send Digest headers to the camera and allow me to programmatically control the PTZ of these cameras. Hopefully this will help someone else in need.

Code: Select all


Imports System.Net
Imports System.IO

' sURL: http://domainOrIpAddress:####/cgi-bin/(SEE AMCREST HTTP API DOCUMENTATION); where #### is port number if camera is not using port 80
' Example: http://mydomain.com:8080/cgi-bin/ptz.cgi?action=start&channel=0&code=GotoPreset&arg1=0&arg2=2&arg3=0 ' This moves to preset #2
Sub sendAmcrestRequest(sURL As String, userName As String, userPassword As String)

Dim wrGETURL As WebRequest
wrGETURL = WebRequest.Create(sURL)

Dim myCache As CredentialCache = New CredentialCache
' Amcrest's ptz.cgi doesn't seem to accept anything but Digest
myCache.Add(New Uri(sURL), "Digest", New NetworkCredential(userName, userPassword))
wrGETURL.Credentials = myCache

Dim objStream As Stream
objStream = wrGETURL.GetResponse.GetResponseStream()

' Only needed if you want to see or act on the returned content
Dim objReader As New StreamReader(objStream)
Dim sLine As String = ""
Do While Not sLine Is Nothing
sLine = objReader.ReadLine
If Not sLine Is Nothing Then
hs.WriteLog("AmcrestRequest", sLine)
End If
Loop

End Sub
erbuell
Posts: 1
Joined: Mon Mar 26, 2018 5:08 pm

Re: camera control help requested

Post by erbuell »

I'm having the same problem as the described by the original post, on my IPM 721 (V2.520 firmware). I notice that the original question was in regard to PositionABS, but the most helpful reply said to use GotoPreset. Is PositionABS deprecated, not implemented in an IPM 721, or broken? Thanks in advance.
jantman
Posts: 33
Joined: Thu May 03, 2018 12:36 pm

Re: camera control help requested

Post by jantman »

There's a long thread elsewhere, CGI SDK no longer functioning on 17r, discussing the removal of Basic Auth in favor of Digest as a "security enhancement". Apparently the API documentation hasn't been updated since before that change was made, but Basic is no longer supported.

I just bought a IP2M-841B on Amazon, software 2.520.AC00.18.R (2017-06-29) and can confirm that the PositionABS code for ptz.cgi appears to be completely dead, generating a 500 with virtually any parameter I can throw at it.
Principal Engineer, Tooling & Automation. Formerly, Wireless & Network Systems Engineer (among many other things).
Doing all sorts of crazy things to anything with an IP address.
http://www.jasonantman.com / http://github.com/jantman
Post Reply