Skip to main content

Python wrapper implementation for Amcrest cameras.

Project description

https://badge.fury.io/py/amcrest.svg https://travis-ci.org/tchellomello/python-amcrest.svg?branch=master https://coveralls.io/repos/github/tchellomello/python-amcrest/badge.svg https://img.shields.io/pypi/pyversions/amcrest.svg

A Python 2.7/3.x module for Amcrest Cameras using the SDK HTTP API. Amcrest and Dahua devices share similar firmwares. Dahua Cameras and NVRs also work with this module.

Documentation: http://python-amcrest.readthedocs.io/

Installation

PyPI

$ pip install amcrest --upgrade
$ eval "$(register-python-argcomplete amcrest-cli)"

# To enable amcrest-cli autocomplete in the system:
$ echo 'eval "$(register-python-argcomplete amcrest-cli)"' >  /etc/profile.d/amcrest-cli-autocomplete.sh

RPM

$ git clone git@github.com:tchellomello/python-amcrest.git
$ ./autogen.sh
$ make rpm
$ dnf/yum install amcrest-cli-NVR.rpm pythonX-amcrest-NVR.rpm

Usage

from amcrest import AmcrestCamera
camera = AmcrestCamera('192.168.0.1', 80, 'admin', 'password').camera

#Check software information
camera.software_information
'version=2.420.AC00.15.R\r\nBuildDate=2016-09-08'

#Capture snapshot
camera.snapshot(0, "/home/user/Desktop/snapshot00.jpeg")
<requests.packages.urllib3.response.HTTPResponse object at 0x7f84945083c8>

#Capture audio
camera.audio_stream_capture(httptype="singlepart", channel=1, path_file="/home/user/Desktop/audio.aac")
CTRL-C to stop the continuous audio flow or use a timer

#Move camera down
camera.ptz_control_command(action="start", code="Down", arg1=0, arg2=0, arg3=0)

#Record realtime stream into a file
camera.realtime_stream(path_file="/home/user/Desktop/myvideo")
CTRL-C to stop the continuous video flow or use a timer

Command Line

$ man amcrest-cli
or
$ amcrest-cli --help

# Saving credentials to file.
$ vim ~/.config/amcrest.conf
[patio]
hostname: 192.168.0.20
username: admin
password: 123456
port: 80

[living_room]
hostname: 192.168.0.21
username: admin
password: secret
port: 80

$ amcrest-cli --camera living_room --version-http-api
version=1.40

Text User Interface (TUI)

Configure amcrest.conf and trigger amcrest-tui, make sure the user triggering amcrest-tui have access to framebuffer device or use sudo.

NOTE: Execute it from console logins, like /dev/ttyX (Non X Window). Pseudo-terminals like xterm, ssh, screen and others WONT WORK.

$ vim ~/.config/amcrest.conf
[patio]
hostname: 192.168.0.20
username: admin
password: 123456
port: 80

[living_room]
hostname: 192.168.0.21
username: admin
password: secret
port: 80

$ amcrest-tui

Supportability Matrix

Cameras

Model

Tested

Status

Results/Issues

IPM-721

Yes

working

IPM-HX1

Yes

working

IP2M-841

Yes

working

IP2M-842

Yes

working

IP3M-941

Yes

working

IP3M-943

Yes

working

IP3M-956

Yes

working

IP3M-956E

Yes

working

IP3M-HX2

Yes

working

IP4M-1026B

Yes

working

IP4M-1051B

Yes

working

IP5M-1176EB

Yes

working

IP8M-2496EB

Yes

working

IP8M-T2499EW-28M

Yes

working

Network Video Recorders (NVR)

Model

Tested

Status

Results/Issues

XVR DAHUA 5104S

Yes

working

If you have different model, feel fee to contribute and report your results.

Help

If you need any help, please join our community on the Gitter channels available at Gitter.

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

amcrest-1.9.7.tar.gz (920.0 kB view details)

Uploaded Source

Built Distribution

amcrest-1.9.7-py3-none-any.whl (155.9 kB view details)

Uploaded Python 3

File details

Details for the file amcrest-1.9.7.tar.gz.

File metadata

  • Download URL: amcrest-1.9.7.tar.gz
  • Upload date:
  • Size: 920.0 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.8.0 pkginfo/1.8.2 readme-renderer/29.0 requests/2.26.0 requests-toolbelt/0.9.1 urllib3/1.26.6 tqdm/4.62.2 importlib-metadata/4.8.1 keyring/23.2.1 rfc3986/1.5.0 colorama/0.4.4 CPython/3.9.10

File hashes

Hashes for amcrest-1.9.7.tar.gz
Algorithm Hash digest
SHA256 394026b2bae680f8eea123b7897272e7e6d9726828695c32e853edaadff8dc77
MD5 b4b05cee29cfd213fa8de1be2109b509
BLAKE2b-256 bbbda1bb9484a39a6b90bc22155ec88f6fddc836f6ff8727a64b3a1aaa7d1608

See more details on using hashes here.

Provenance

File details

Details for the file amcrest-1.9.7-py3-none-any.whl.

File metadata

  • Download URL: amcrest-1.9.7-py3-none-any.whl
  • Upload date:
  • Size: 155.9 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.8.0 pkginfo/1.8.2 readme-renderer/29.0 requests/2.26.0 requests-toolbelt/0.9.1 urllib3/1.26.6 tqdm/4.62.2 importlib-metadata/4.8.1 keyring/23.2.1 rfc3986/1.5.0 colorama/0.4.4 CPython/3.9.10

File hashes

Hashes for amcrest-1.9.7-py3-none-any.whl
Algorithm Hash digest
SHA256 4c804f58f75b48c997fcebe86287e649c0ffdc76cdf45f85a9d7a66b9830a280
MD5 fdcbcc256d4168e7592dce8849f8bdf4
BLAKE2b-256 e7d4dd574749c81ced50b1b2ce3d568d72e3e402b873f5a13a0420727304f496

See more details on using hashes here.

Provenance

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