Using ISAPI to download short video clips?

XenoXenox

n3wb
Feb 2, 2021
3
2
Northern California
Hello Everyone!

I'm writing a custom tool to download pictures and video from a Hikvision NVR (DS-7616NI-I2/16P) that is capturing vehicles and license plates from a Hikvision license plate camera (DS-2CD7A26G0/P-IZHS8).

Using ISAPI, I'm successfully able to perform a vehicle detection search and download the license plate photos from the NVR. So far so good.

I would also like to download short video clips (around ten seconds) centered on the time of the license plate capture, but I haven't yet found a way to do this in ISAPI. I can download the full video file for that hour or so of video, but that's very slow and is far more video than I need.

Is there an easy way to download a short clip of video using ISAPI? I know that iVMS-4200 can download both photos and video clips of license plate events, but I don't think it uses ISAPI to download the video. I captured the network packets with Wireshark and saw JPEG picture downloads in the ISAPI HTTP requests, but no video ISAPI requests.

If ISAPI can't do it, is there another way to capture clips? If needed, I can keep a USB drive connected to the NVR for short-term storage while exporting clips and downloading them, but I ultimately need the clips to be downloaded to a remote laptop running my software.

Any advice would be appreciated!
 
I found a solution that works.

1) Use "http:<username>:<password>@<IP ADDRESS>/ISAPI/SDT/Management/IntelligentSearch?format=json" to search for vehicle photos in the desired time range.

2) Download each license plate photo using the URIs in the above search results.

3) Download a ten second video clip centered on each of these license plate captures using FFMPEG with the following options:
ffmpeg -rtsp_transport tcp -hide_banner -loglevel error -i "rtsp:/<<username>:<password>@<NVR IP ADDRESS>:554/ISAPI/streaming/tracks/101?starttime=20210204T002131Z&endtime=20210204T002141Z" -map 0:v -t 10 -acodec copy -vcodec copy output.mp4

This works, but is slow as the video clips need to play back in real-time via RTSP as they are being downloaded. If anyone can think of a faster way to transfer the video clips, I would appreciate it. The iVMS-4200 tool seems to download the license plate video clips much faster than real-time.
 
Last edited: