解析海康威视IP摄像头存储视频的Hikvision数据目录
libhikvision的Python项目详细描述
利比克威视
Python库来解析Hikvision IP摄像机存储视频的Hikvision数据目录。 使用这个类,您可以查看存储在datadir中的录制的详细信息,并提取视频和缩略图。在
工作示例
#!/usr/bin/python3fromlibhikvisionimportlibHikvisionfromdatetimeimportdatetimecameradir='/var/tmp/hikvision/'hik=libHikvision(cameradir,'video')# Gets information about the structure of the filesforfileinhik.getFiles():print(file)# Get information about the serverprinthik.getNASInfo()# Extract the segments within a specific range of datessegments=hik.getSegments(from_time=datetime(2019,8,21,22,23,30),to_time=datetime(2019,8,21,22,25,00),)# Extract the Videos and Images from segments found abovefornum,segmentinenumerate(segments,start=0):print('{0:4}) {1[cust_filePath]:55}{1[cust_duration]:5}{1[startOffset]:10}{1[endOffset]:10}{1[cust_startTime]} - {1[cust_endTime]}'.format(num,segment))print(hik.extractSegmentMP4(num,cachePath='/var/tmp/',filename='/var/tmp/video{0}.mp4'.format(num)))print(hik.extractSegmentJPG(num,cachePath='/var/tmp/',filename='/var/tmp/video{0}.jpg'.format(num)))
您还应该检查每个方法的文档,以获得额外的选项。在
学分
基于davehope在https://github.com/davehope/libHikvision上提供的PHP代码
- 项目
标签: