Dahua / Amcrest HTTP API

SCN

n3wb
Joined
Nov 2, 2018
Messages
9
Reaction score
1
Location
Corona, CA
Hi,

I am working with the Amcrest HTTP API 3.2017, I am interested in retrieving the system recording duration. I have ran through the API and cannot see to find exactly what I am looking for, but more or less I need to figure out the API URL that will return the first recording and last recording stored on the HDD.

I thought I would be able to find this information in the motion logs, or some the mediaFileFind, but the results I have received are not what I can use.

Any suggestions?

Thanks
 

SCN

n3wb
Joined
Nov 2, 2018
Messages
9
Reaction score
1
Location
Corona, CA
After some deliberation, I managed to pull motion events that gave me the oldest date, but I am capped on 100 events per request and when I tried to pull over and over to get to the most recent, my object ID aka session ends and it throws an error. The problem is that if I create a new session I start over and that would be a problem. Obviously there is another way to do this..

My goal is to determine the number of days that have recordings and show the oldest recording date. The reason why I cannot calculate this based on what I have is because systems go offline and therefor recording could be off for days at a time if someone is not paying attention. I could have resolved this if the session would let me pull all events, but that is where I hit a wall..

Any ideas or suggestions would be greatly appreciated. Thank!
 

tangent

IPCT Contributor
Joined
May 12, 2016
Messages
4,342
Reaction score
3,524
Prevailing advice on the forum is to record continuously 24-7. Motion/IVS/etc. are useful, but if you only record on these event's it's easy to miss things you would have liked to record.
Continuous recording also makes the Dahua timeline interface behave much better.

Maybe one of the storage parameters would help. You could also build something that subscribes to events and log externally.

IDK what your ultimate goal is, but I suspect you might be better off with VMS software on a PC than a Dahua NVR.
 
  • Like
Reactions: SCN

SCN

n3wb
Joined
Nov 2, 2018
Messages
9
Reaction score
1
Location
Corona, CA
Thank you for your response. Unfortunately system configuration is out of my control, I just need to retrieve the information as it lies on the system. I just want to determine how many days worth of recordings are on the system. Subscribing to events is a very good idea as I can make something of that and provide some analytical data alongside my original thoughts. I will give it a try and see how it works. Thank you tangent.

My ultimate goal was to connect to a batch (hundreds) of customer systems and pull information for the customer to see. When dealing with customers, they tend to want to know how many days worth of recordings their system has and if the date they want to pull a recording still exists. Many of my customers do not pull their own video, so this is a simple tool that will provide the quick answer, yes I can retrieve something, or no do not bother to try.

I have also found that my interaction with the API <-> DVR is significantly faster than the VMS software. What takes about 1 minute to determine with VMS will take 20 seconds on my web based tool.
 

tangent

IPCT Contributor
Joined
May 12, 2016
Messages
4,342
Reaction score
3,524
Thank you for your response. Unfortunately system configuration is out of my control, I just need to retrieve the information as it lies on the system. I just want to determine how many days worth of recordings are on the system. Subscribing to events is a very good idea as I can make something of that and provide some analytical data alongside my original thoughts. I will give it a try and see how it works. Thank you tangent.

My ultimate goal was to connect to a batch (hundreds) of customer systems and pull information for the customer to see. When dealing with customers, they tend to want to know how many days worth of recordings their system has and if the date they want to pull a recording still exists. Many of my customers do not pull their own video, so this is a simple tool that will provide the quick answer, yes I can retrieve something, or no do not bother to try.

I have also found that my interaction with the API <-> DVR is significantly faster than the VMS software. What takes about 1 minute to determine with VMS will take 20 seconds on my web based tool.
You should experiment more with what Dahua's SmartPSS and DSS software can do.

On that scale, I'd you should probably also consider having things like outdoor motion sensors tied into alarm inputs of the NVRs.
 

SCN

n3wb
Joined
Nov 2, 2018
Messages
9
Reaction score
1
Location
Corona, CA
Are you referring to interfacing with SmartPSS and DSS using the HTTP API or just using it through the client software.

The problem with Dahua's software is that SmartPSS has a limit of 64 sites. I am unable to add the triple digits that I need to.

The point of my project is automation and ease of access for both myself and the client through a browser based management system. I am seeking solutions with the HTTP API. I am fully aware of the abilities of SmartPSS and DSS, but feel they are not the direction I am heading. If you feel different, please convince me with a more detailed explanation. I am always interested in hearing your opinion and open to new ideas.

Thank you tangent.
 

catcamstar

Known around here
Joined
Jan 28, 2018
Messages
1,659
Reaction score
1,193
I am intriged by what you are trying to achieve, especially in the light of GDPR: are you the sole "service provider" having access to all these triple digit sites, or is this going to be a fully multi-tenant (with data separation, encryption & ditto security) regulations imposed? I'm just thinking whether (or not) I personally would like that idea ;-)
 
  • Like
Reactions: SCN

SCN

n3wb
Joined
Nov 2, 2018
Messages
9
Reaction score
1
Location
Corona, CA
This would be a multi-tenant application, but if granted by the customer, I may act as a service provider as I hold the service contract to specific sites. I have a login system in place with modern security, SHA512 data encryption and SSL cert... there are so many amazing and unique features that are going to be implemented.
 

SCN

n3wb
Joined
Nov 2, 2018
Messages
9
Reaction score
1
Location
Corona, CA
So after the frustration of not finding anything helpful in the API for retrieving specific date ranges (not sure how Dahua's web does it.. may have to reverse engineer their page), I was able to run a sluggish daisy chain of requests by creating a new finder, querying a large date range, then killing the finder, narrow the date range to the oldest date located in the query and repeating the query for motion events. Basically this tells me that there was a motion event (which in theory triggered recordings) each day that I return a result. Since the query contains 100 items, I log each of the unique dates on the system to build my index array.

Unfortunately I do not feel confident in the accuracy of this as if the HDD fails, the system is logging motion events, would it give me a false positive? So far on a working DVR this has been fine and only shows motion events for days I have verified recordings.

Hopefully I can figure out that magic command from the API that will give me the quick solution I am looking for. I feel that Dahua has a better method than what I have accomplished as I should never have to run 20+ requests to the API to get this information.

=================================================================================

After a day of grueling reverse engineering, I found that Dahua has a simpler method for retrieving this information. I am now moving on to Wireshark to capture the exact conversation taking place to see what is sent to where and what data is returned to the client. Hopefully some more luck.

=================================================================================

Finally ANSWERS! It appears that I was using the same method as Dahua! but I need to make my version more efficient in how is utilizes the information as there are many loop cycles wasted due to irrelevant data. Once I am done cleaning this up, I hope to see some performance increase.
 
Last edited:

SCN

n3wb
Joined
Nov 2, 2018
Messages
9
Reaction score
1
Location
Corona, CA
Over one year later, the project has been rebooted. I will also be integrating Hikvision's API (SDK) into this one. I am attempting to build an application that puts me out of a job. Can I succeed?
 

adamg

Pulling my weight
Joined
Sep 19, 2017
Messages
250
Reaction score
129
It's surprising how even the fancy commercial VMS applications make it difficult or nearly impossible to quickly determine how many days' worth of footage each camera has. You'd think they would flaunt that info to the user prominently in the interface and be proud enough to make it easy to query in an API.
 

deborahj

n3wb
Joined
Feb 25, 2020
Messages
1
Reaction score
0
Location
Pune, India
Hi Is there a way through which i can download recording for a given date range? Any help would be much appreciated . TIA.
 
Top