Smart PSS - Playback IPC IVS Events from NVR

tigerwillow1

Known around here
Joined
Jul 18, 2016
Messages
3,849
Reaction score
8,520
Location
USA, Oregon
Doh, I was using a bad ip address. Don't have a clue where I pulled it out of. Here's the line:

table.VideoAnalyseRule[0][0].EventHandler.TimeSection[0][0]=1 00:00:00-23:59:59
And the camera's schedule page. I don't have an IVS selection here, either.
cameraSchedule.jpg
 

Jtpowell

n3wb
Joined
Nov 15, 2016
Messages
23
Reaction score
7
I do not have these sub-menus under the Event menu:
  • Smart Plan
  • IVS
  • Vehicle
  • People Counting
  • Heat Map
Across the top-most tabs, I do not have the "Smart Play" tab.
 

Jtpowell

n3wb
Joined
Nov 15, 2016
Messages
23
Reaction score
7
A couple of quick status updates...

I've contacted the seller I bought it from for support--they're looking into the issue to see if they can help in any way.

I contacted Dahua North America's Support, but they advised they couldn't assist as it's not a product "geared for the North America market." Understandable.

I'm not overly optimistic about an official solution at this point, so I've started writing some tools in PowerShell to recreate this functionality using the API. I'm sure I'll have to make compromises with the end result, but I'll figure that out along the way. I'll share my tools if I get it working. Besides, once I have the basics put together, it'll be simpler to make new functions for other functionality exposed by the API.
 

tigerwillow1

Known around here
Joined
Jul 18, 2016
Messages
3,849
Reaction score
8,520
Location
USA, Oregon
@tigerwillow1 What record types does your NVR schedule have available (similar to your first screenshot from your camera)?
nvrSchedule.jpg
I have this sinking feeling that there's some simple explanation that nobody has thought of. Something similar to or on order of the camera manufacturer not being set to "private" on the registration page. Or the camera firmware somehow thinking your nvr is a different model than what it really is.
 

Jtpowell

n3wb
Joined
Nov 15, 2016
Messages
23
Reaction score
7
Checking in with an update for anyone who's following.

I'm still pursuing a DIY solution using the API and PowerShell. I'm mostly focused on getting basic pieces of the workflow built (e.g., authentication, parsing responses, etc.), but I have a rough idea of where I'm heading with the first version.

Here's an outline of what I'm aiming for:
  1. For each IVS rule on each camera, enable logging on the camera.
  2. Retrieve the start/stop times for each IVS event from each camera.
  3. Select the event(s) I want to view, use the start/stop times from the log to retrieve the video from the NVR.
The tools I'm building will let me automate as much of this process as I'd like to later on. I think I could go so far as to have the script create the IVS event records on the NVR so I can see them on the timeline in the playback view, but I don't think this is really necessary since I can build that view as a table or whatever in PowerShell. I also think I could analyze the video stream and monitor for events directly in the packet headers, but I can't think of a use case to make this worth the time right now.

Handling authentication took several days for me to figure out. It looks like Dahua dropped basic auth, which left me with digest authentication. I had to write a function to manage digest auth since Powershell's Invoke-WebRequest commandlet doesn't handle it out of the box. There's a response value that has to be calculated client-side that isn't too bad, but I got stuck on a bug with my implementation for a couple of days due to how pwsh outputs MD5 hash values. I'm mentioning this here just in case someone else searches the forums one day for this same problem. Since the final step of the calculation requires you to take an MD5 hash that uses two other MD5 hashed values as input, you have to change the the two input MD5 hashes to all lower case letters first (because the MD5 algorithm is case sensitive). pwsh outputs the MD5 hash values as hexadecimal, and it uses all upper case letters to display the value (which in turn borks the final MD5 value if you don't change the case first).

I'll post the source for my full set of tools once I have this working. They should actually be flexible enough to reuse for any other automation you might want to do with the cameras or the NVR.
 

Jtpowell

n3wb
Joined
Nov 15, 2016
Messages
23
Reaction score
7
Checking in...

I have my scripts working. They need some fine tuning, but the overall experience is very good. I still plan to make my scripts more generic and share them out after a little more clean up.

An overview of what my PowerShell command currently does:
  • I run this command: Show-DahuaIVSVideos -lastnight
  • It fetches the logs from each camera.*
    • The logs are filtered to only include IVS events.
    • I find all event start times.
      • I find all event start times that are within 10 seconds of each other.
      • For each of these subgroups, I retain only the first start time value.
    • For each start time I retained, I find the corresponding event end time from the log entries.
  • For each of the manufactured event records I just created, I build the URLs that will be used to request the videos with the corresponding start/stop times.
    • E.g., "rtsp://192.168.1.101/cam/playback?channel=1&starttime=2018_06_03_21_00_00&endtime=2018_06_04_06_00_00"
  • I assemble a command to open VLC and queue up the collection of URLs in the playlist and then play them sequentially.
Using VLC as my player has given me a lot of flexibility (though I'm still learning what all I can do with it). I also built a script that opens the live streaming feed for both of my cameras and plays them on my desktop in a custom sized, styled, and positioned window(s). I work from home, and I like having my cameras open with a small footprint so I can see activity at a glance. Attaching a screen shot that shows what this looks like. I have a dual-monitor setup, so this is one corner of one screen.

2018-06-04_8-16-47.png

* My cameras apparently only retain logs locally for a day or so. I created a function to automatically backup their logs to a remote storage device each day so I can retrieve events from a greater time range.
 
Last edited:

tigerwillow1

Known around here
Joined
Jul 18, 2016
Messages
3,849
Reaction score
8,520
Location
USA, Oregon
Thanks for posting the updates. I'm sure glad I didn't have to go through this "learning experience". Wish I could help more, but I ran out of ideas.
 

Jtpowell

n3wb
Joined
Nov 15, 2016
Messages
23
Reaction score
7
Thanks for posting the updates. I'm sure glad I didn't have to go through this "learning experience". Wish I could help more, but I ran out of ideas.
I really appreciate your help, man. I wouldn’t have gotten as far as I did without you and everyone else. The fact that you all were so eager to help me is why I’m making these check in posts and will share out my scripts—I hope they may be useful to someone else.
 

Jtpowell

n3wb
Joined
Nov 15, 2016
Messages
23
Reaction score
7
Hi

@Jtpowell , any idea when you will post the script ?
I want to under-promise on this one--it's a fair amount of work to make them more generic for others to use so you don't have to modify the actual source. I wrote twelve functions for this module, all told. Somewhere between the endless demands of work and home life, I'm sure I'll need a break and I'll knock these out in the next two weeks. :)

2018-06-04_21-27-31.png
 

drdre84

n3wb
Joined
Jun 30, 2019
Messages
14
Reaction score
2
Location
australia
in iDMSS
how do you playback IVS events when we cant select ivs?
is it smart recording?
does anyone know, because it is not motion.
 

Attachments

Top