Skip to main content

Parse Hikvision datadirs that Hikvision IP cameras store the videos

Project description

LibHikvision

PyPI Version

Python library to parse Hikvision datadirs that Hikvision IP cameras store the videos. Using this class you can view details about recordings stored in a datadir and extract video and thumbnails.

Working Example

#!/usr/bin/python3

from libhikvision import libHikvision
from datetime import datetime

cameradir = '/var/tmp/hikvision/'
hik = libHikvision(cameradir, 'video')

# Get information about the server
print hik.getNASInfo()

# Extract the segments within a specific range of dates
segments = 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 above
for num, segment in enumerate(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)))

You should also check the documentation of each method for extra options.

Credits

Based on Dave Hope's PHP code available at https://github.com/davehope/libHikvision

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

libhikvision-0.3.9.tar.gz (5.9 kB view details)

Uploaded Source

Built Distribution

libhikvision-0.3.9-py3-none-any.whl (6.4 kB view details)

Uploaded Python 3

File details

Details for the file libhikvision-0.3.9.tar.gz.

File metadata

  • Download URL: libhikvision-0.3.9.tar.gz
  • Upload date:
  • Size: 5.9 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.7.1 importlib_metadata/4.10.1 pkginfo/1.8.2 requests/2.27.1 requests-toolbelt/0.9.1 tqdm/4.62.3 CPython/3.10.2

File hashes

Hashes for libhikvision-0.3.9.tar.gz
Algorithm Hash digest
SHA256 8d7dff444b46147016d070c40ef7949688bfbfed4d8bfcecd7b9c68363f693b0
MD5 3df4ddc428e5ac5ca8e5a59f87f07923
BLAKE2b-256 93dc99fe10b4b0bb777284c449b83b474298aea7c3ca87dd929e17af1728ed4d

See more details on using hashes here.

File details

Details for the file libhikvision-0.3.9-py3-none-any.whl.

File metadata

  • Download URL: libhikvision-0.3.9-py3-none-any.whl
  • Upload date:
  • Size: 6.4 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.7.1 importlib_metadata/4.10.1 pkginfo/1.8.2 requests/2.27.1 requests-toolbelt/0.9.1 tqdm/4.62.3 CPython/3.10.2

File hashes

Hashes for libhikvision-0.3.9-py3-none-any.whl
Algorithm Hash digest
SHA256 0b94fe1ecc9648e52c90973a6e3e003a8a23808e9cfb54c80e7ea6828a5466e1
MD5 e33002e432f9fdfc4b8e64f55079f906
BLAKE2b-256 d6f4539bec6fc21f9d796c1e82b3f896eece1127657179bf91bfe8410ac0c050

See more details on using hashes here.

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page