Author Topic: Amcrest ProHD 1080P  (Read 8908 times)

Offline GaryTTirn

  • Newbie
  • *
  • Posts: 13
  • Karma: +0/-0
Re: Amcrest ProHD 1080P
« Reply #30 on: May 21, 2017, 02:41:00 pm »
Seem the latest firmware for IP2M-841B (Amcrest_IPC-AWXX_Eng_N_V2.420.AC00.17.R.20170322) uses HTTP Digest access authentication which is not compatible with Vera.
Newer firmware will return HTTP 401 Unauthorized for Basic HTTP authentication that Vera uses  (both UI5 and UI7).

Last working firmware for Vera is https://s3.amazonaws.com/amcrest-files/Firmware/Amcrest_IPC-AWXX_Eng_N_V2.420.AC00.16.R.20160909.bin

In case somebody is having issues connecting the camera to Vera this could be the reason.

Offline jswim788

  • Hero Member
  • *****
  • Posts: 506
  • Karma: +25/-2
Re: Amcrest ProHD 1080P
« Reply #31 on: May 21, 2017, 06:21:34 pm »
HTTP Digest access authentication which is not compatible with Vera.
Looks like the plugin could be modified to support digest authentication, but it would take some effort.  See these among others:

http://forum.micasaverde.com/index.php?topic=27650.0
http://forum.micasaverde.com/index.php/topic,29897.msg212423.html#msg212423

Offline tedp

  • Full Member
  • ***
  • Posts: 249
  • Karma: +4/-2
Re: Amcrest ProHD 1080P
« Reply #32 on: May 22, 2017, 08:07:56 am »
HTTP Digest access authentication which is not compatible with Vera.
Looks like the plugin could be modified to support digest authentication, but it would take some effort.  See these among others:

http://forum.micasaverde.com/index.php?topic=27650.0
http://forum.micasaverde.com/index.php/topic,29897.msg212423.html#msg212423
..or Amcrest can get their s**t together and fix all the problems they introduced with the last firmware build. If you go to their forums you can see there are all sorts of issues, including unsolicited connections to their cloud servers even for customers who do NOT subscribe. I'm considering replacing mine with another brand.

Sent from my Nexus 5X using Tapatalk


Offline GaryTTirn

  • Newbie
  • *
  • Posts: 13
  • Karma: +0/-0
Re: Amcrest ProHD 1080P
« Reply #33 on: August 02, 2017, 12:21:08 pm »
Sadly, I have not yet figured out how to make Vera work with HTTP Digest Authentication as Vera keeps on defaulting to Basic Authentication at least for Generic IP Camera and thus Vera cannot retrieve an image from the camera.

It should be possible to use os.execute and curl in the implementation file to get other HTTP functions working on Vera provided some firmware update brings needed support for HTTP digest authentication Vera own functions (REQ_Image and others)

It does say in the UI7 change log that support would be there but I still don't know why Vera would not attempt digest authentication after failed Basic authentication.
http://support.getvera.com/customer/portal/articles/2078473-ui7-%E2%96%BE-version-7-0-10-1-7-649-1-7-1320-%E2%96%BE-july-30-2015

So the Amcrest_IPC-AWXX_Eng_N_V2.420.AC00.16.R.20160909.bin firmware i still the latest working one.

However, I figured out a method to get the motion detection working somehow but it is a quite involved process.
It is based on polling the Camera Relay Out State via HTTP interface using a Vera scene instead of the camera telling Vera that motion sensor has been tripped.

I made a new, enhanced implementation file that contains needed actions to enable both Video and Audio detection from Vera via a Motion Sensor Device.
Do note the new SetArmed-function (and thus armed/disarmed buttons on the motion sensor) only ticks/unticks the enabled setting in the camera settings, you still need to manually enabled desired actions (Relay-Out, Record, Snapshot etc.) in the camera settings

Firstly, "Relay-Out"-option in the Video and Audio Detection must be enabled in the camera event settings for this polling solution to work as otherwise the state doesn't get updated.

Secondly, a Motion Sensor device must be created which can be done by adding the Camera Device ID to the URL below by replacing CAMERA-DEVICE-ID in the URL.
You can see the Camera Device ID from vera Camera->Settings->Advanced->Extra Parameters as device #xxx (id field tells the same)

http://VERA_IPADDRESS:3480/data_request?id=action&serviceId=urn:micasaverde-com:serviceId:HomeAutomationGateway1&action=CreateDevice&deviceType=urn:schemas-micasaverde-com:device:MotionSensor:1&internalID=&Description=Camera%20motion%20sensor&UpnpDevFilename=D_MotionSensor1.xml&UpnpImplFilename=&IpAddress=&MacAddress=&RoomNum=0&DeviceNumParent=CAMERA-DEVICE-ID

The URL should return the device id of the newly created motion sensor and if all went right, the device will also appear in the Vera UI.
Make a note of the device id, you might need it in case  you need to delete the device without having it visible in the Vera.

Device can be deleted using this URL http://VERA_IPADDRESS:3480/data_request?id=device&action=delete&device=SENSOR-DEVICE-ID.
Do be careful, any device can be deleted using that method.

After that has been done, you can create a scene that executes this LUUP code with the proper camera login and IP address details every minute or every 30 seconds for example.
Remember to replace the SENSOR_DEVICE_ID with the ID of your newly created sensor device in the LUUP code.

local cameraURL = "http://USERID:PASSWORD@CAMERA-IP-ADRESS/cgi-bin/alarm.cgi?action=getOutState"

-- CamSensorID is the ID of the Motion sensor.
local CamSensorID = SENSOR_DEVICE_ID

-- Get the camera device state, result=0 or result=1
local status, response = luup.inet.wget(cameraURL,5);

-- Get the alarmState (last character and add 0 to alarmState to convert it to an integer
local alarmState = string.sub(response,-2) + 0;

-- if motion alarm set motion sensor to tripped
if alarmState == 1 then
    luup.variable_set ("urn:micasaverde-com:serviceId:SecuritySensor1", "Tripped", 1, CamSensorID);
else
    luup.variable_set ("urn:micasaverde-com:serviceId:SecuritySensor1", "Tripped", 0, CamSensorID);
end

After this you can use the Motion Sensor device to trigger notifications or other scenes.
« Last Edit: August 03, 2017, 01:56:18 pm by GaryTTirn »

Offline tedp

  • Full Member
  • ***
  • Posts: 249
  • Karma: +4/-2
Re: Amcrest ProHD 1080P
« Reply #34 on: August 02, 2017, 12:26:52 pm »
I finally upgraded one of my Veras to UI7 and can confirm that it does indeed work with my Amcrest's latest firmware. Hope this helps.

Offline GaryTTirn

  • Newbie
  • *
  • Posts: 13
  • Karma: +0/-0
Re: Amcrest ProHD 1080P
« Reply #35 on: August 02, 2017, 01:51:25 pm »
Quite interesting, I tried Amcrest_IPC-AWXX_Eng_N_V2.420.AC00.18.R.20170521.bin on my IP2M-841 with settings reset to defaults as instructed and it still doesn't seem to work with Vera Edge running firmware 1.7.2931.  This 18.R Amcrest version certainly tries to do HTTP Digest Authentication like 17.R

Actually the snapshot URL doesn't work with anything anymore in 18.R...not Firefox, Crome or linux tools like curl.

root@MiOS_xxxx:~# curl -v --digest http://vera:password@192.168.15.10/cgi-bin/snapshot.cgi
> GET /cgi-bin/snapshot.cgi HTTP/1.1
> User-Agent: curl/7.38.0
> Host: 192.168.15.10
> Accept: */*
>
< HTTP/1.1 401 Unauthorized
< WWW-Authenticate: Digest realm="Login to AMC",qop="auth",nonce="445233875",opaque="3f4a9ea877eade28d7a3ee3bd098d10ab29b8831"
< Connection: close
< CONTENT-LENGTH: 0
<
> GET /cgi-bin/snapshot.cgi HTTP/1.1
> Authorization: Digest username="vera", realm="Login to AMC", nonce="445233875", uri="/cgi-bin/snapshot.cgi", cnonce="MGE5YjY5OTYwZDQxZWMyYTVkN2UzYjljMzVlNWRhMTk=", nc=00000001, qop=auth, response="bcfc902e6e02bdef7631e73c8ff5a905", opaque="3f4a9ea877eade28d7a3ee3bd098d10ab29b8831"
> User-Agent: curl/7.38.0
> Host: 192.168.15.10
> Accept: */*
>
* Empty reply from server
curl: (52) Empty reply from server

Same thing will happen with URL
curl -v -uvera:password  --digest http://192.168.15.10/cgi-bin/snapshot.cgi

The live stream will work even over HTTP, so there is something fishy in the cgi-interface of 18.R.
root@MiOS_xxx:~# curl -v -uvera:password  --digest http://192.168.15.10/cgi-bin/mjpg/video.cgi?channel=0\&subtype=1 -O /dev/null
  % Total    % Received % Xferd  Average Speed   Time    Time     Time  Current
                                 Dload  Upload   Total   Spent    Left  Speed
  0     0    0     0    0     0      0      0 --:--:-- --:--:-- --:--:--     0> GET /cgi-bin/mjpg/video.cgi?channel=0&subtype=1 HTTP/1.1
> User-Agent: curl/7.38.0
> Host: 192.168.15.10
> Accept: */*
>
< HTTP/1.1 401 Unauthorized
< WWW-Authenticate: Digest realm="Login to AMC",qop="auth",nonce="180909467",opaque="3f4a9ea877eade28d7a3ee3bd098d10ab29b8831"
< Connection: close
< CONTENT-LENGTH: 0
<
  0     0    0     0    0     0      0      0 --:--:-- --:--:-- --:--:--     0
> GET /cgi-bin/mjpg/video.cgi?channel=0&subtype=1 HTTP/1.1
> Authorization: Digest username="vera", realm="Login to AMC", nonce="180909467", uri="/cgi-bin/mjpg/video.cgi?channel=0&subtype=1", cnonce="MGEyOTFhNDYyOTUxOTJjYjFhZGI0ODQ5MjVkZmQ3YTM=", nc=00000001, qop=auth, response="dead74a927d0e4226f998f6d861bfed1", opaque="3f4a9ea877eade28d7a3ee3bd098d10ab29b8831"
> User-Agent: curl/7.38.0
> Host: 192.168.15.10
> Accept: */*
>
< HTTP/1.1 200 OK
< Cache-Control: no-cache
< Pragma: no-cache
< Expires: Thu, 01 Dec 1994 16:00:00 GMT
< Connection: close
< Content-Type: multipart/x-mixed-replace; boundary=myboundary
<
{ [data not shown]
100 70585    0 70585    0     0  49739      0 --:--:--  0:00:01 --:--:-- 76409^C
root@MiOS_xx:~#

Edit : later I actually figured out the issue with the snapshot.cgi, the storage destination option for snapshots had gotten cleared in the camera settings, most likely due to resetting to defaults.
I started wondering what is wrong as snapshot.cgi would not work even in the 16.R anymore...

Anyways, I rolled back to 16.R for now.
« Last Edit: August 05, 2017, 06:37:28 am by GaryTTirn »

Offline rafale77

  • Hero Member
  • *****
  • Posts: 696
  • Karma: +35/-20
Re: Amcrest ProHD 1080P
« Reply #36 on: August 04, 2017, 04:43:53 pm »
There is something messed up with the RTSP stream of the 18.R aka version 11. I have a ticket opened with Amcrest about this. I am seeing it on both the IP2M and and the IP3M versions of the camera... Amcrest said they know there is a problem and expecting a fix on the next version but couldn't give me a date. I am sticking with 17.R aka version 10 for now.
127 zwave nodes, 8 zigbee nodes, 256 devices, 17 apps, 128 scenes on a Vera Plus linked with Echo and HomeKit through bridges

Offline GaryTTirn

  • Newbie
  • *
  • Posts: 13
  • Karma: +0/-0
Re: Amcrest ProHD 1080P
« Reply #37 on: September 09, 2017, 07:01:41 am »
I got a Wansview W2 to play with and it requires HTTP Digest Authentication just like recent Amcrest firmwares.

Wansview works fine with Vera Edge with Vera firmware 1.7.3014 regardless of the digest authentication, so I gave Amcrest a 17.R one more go.

Indeed, these versions seem to work fine with Vera and do have HTTP Digest Authentication enabled.

IP2M-841:
https://s3.amazonaws.com/amcrest-files/Firmware/IP2M-841_IPM-721_International_V2.420.AC00.17.R.20170322.zip

IP3M-943:
https://s3.amazonaws.com/amcrest-firmwares/Amcrest_IPC-ACK-Themis_Eng_P_AMCREST_V2.400.AC02.15.T.20170714.bin

Something got fixed in Vera, so I'm a happy camper.

Offline GaryTTirn

  • Newbie
  • *
  • Posts: 13
  • Karma: +0/-0
Re: Amcrest ProHD 1080P
« Reply #38 on: September 11, 2017, 01:28:31 pm »
I finally figured out how to get streaming working at least somehow through Vera.

One has to create a variable called Streams under the the camera device in Vera with this value
rtsp,rtsp,/cam/realmonitor?channel=1&subtype=0;rtsp_low,rtsp,/cam/realmonitor?channel=1&subtype=1

The variable is mentioned here http://wiki.micasaverde.com/index.php/Luup_UPnP_Variables_and_Actions

The variable is added by accessing the web UI and going to Cameras->Amcrest Camera device->Settings->Advanced->Extra Parameters->New Service

The new variable is defined with these values :

New service: Streams
New variable: Streams
New value: rtsp,rtsp,/cam/realmonitor?channel=1&subtype=0;rtsp_low,rtsp,/cam/realmonitor?channel=1&subtype=1

First RTSP URL in the variable value is used locally and for that I selected the camera's Main Stream (subtype 0) and this streams fine when camera is viewed with the Vera android app.
The app reports "Type of streaming : continuous" and there is even audio included if it is enabled in the camera.

The second RTSP URL is used when connected remotely and for that I selected the camera's Sub Stream (subtype 1) and doesn't seem to work at all in continuous streaming mode.
Could be my limited Internet uplink that is causing issue, but cannot tell for certain. Didn't make a difference if the Main Stream was used.
Vera does log in the LuaUPnP.log that stream tunnel has been created even over the remote connection, so the stream should work.

There doesn't seem to be a way to make streaming work in a web browser.
in that case Vera searches for URLs flv anf flv_low from the Streams variable and runs flowplayer in the browser via flash as a plugin.
However I could not make flowplayer accept any of the streams the camera supports, so I didn't define those URLs in the Stream variable n the end.

I attached an updated implementation file that takes care of adding the Streams variable if it doesn't exits yet.

Offline Schtruck

  • Newbie
  • *
  • Posts: 3
  • Karma: +0/-0
Re: Amcrest ProHD 1080P
« Reply #39 on: September 22, 2017, 07:21:51 am »
Thanks!

i tried but i see no change

i have about 1 image every 7 second and i cannot see any control for zoom?

have i missed something?


Offline GaryTTirn

  • Newbie
  • *
  • Posts: 13
  • Karma: +0/-0
Re: Amcrest ProHD 1080P
« Reply #40 on: September 25, 2017, 10:47:52 am »
Were you connected to the local LAN ? That is the only way I managed get the streaming working and even then it might fail sometimes.
Using remote connection, Vera always falls back to frame by frame mode.

If you can access your Vera via SSH, you can confirm from the log that Vera opens stream_tunnel when you start Live View of the camera in the app.

root@MiOS_X:~# grep -i stream_tunnel /var/log/cmh/LuaUPnP.log
04   09/25/17 17:39:17.887   <Job ID="1012" Name="stream_tunnel" Device="281" Created="2017-09-25 17:39:17" Started="2017-09-25 17:39:17" Completed="2017-09-25 17:39:17" Duration="0.513000" Runtime="0.0" Status="Successful" LastNote=""/> <0x7380e520>

I suppose it could also be a codec issue, I have set my IP2M-841 Main Stream to use H264H, 1080P, frame rate 15, VBR, Quality 6, 8192kbp/s and frame interval 30.
AAC audio is included in the stream.

I never saw zoom controls in UI7, but when I used to have a Vera 2 with UI5, Zoom control were visible and worked.
Having only Amcrest cameras with digital zoom, I haven't bothered to search a solution.