A Python 2.7/3.x module for Amcrest Cameras using the SDK HTTP API.
Clone or download
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Permalink
Failed to load latest commit information.
cli Fixed lint (#93) Mar 6, 2018
docs Added IP3M-956B to supportability matrix docs (#94) Mar 6, 2018
examples some examples Dec 18, 2017
man amcrest: send audio to camera Mar 20, 2017
presentations Add presentation from Boston Python Linux Group Dec 19, 2017
src/amcrest Added setter for recording on motion detection (#95) Mar 6, 2018
tests Keep unicode tests compability with Python3 Mar 29, 2017
tui Using lint on Python 3 Mar 29, 2017
.coveragerc Added first commit to organize unittests/coveralls.io/travis Mar 16, 2017
.gitignore Added .pypirc to .gitignore Nov 24, 2016
.hound.yml Introducing yet another check code style bot Houndci bot Jan 11, 2017
.travis.yml Using lint on Python 3 Mar 29, 2017
AUTHORS AUTHORS: adding authors file Oct 23, 2016
COPYING amcrest: license change Oct 23, 2016
MANIFEST.in Updated setup.py and included MANIFEST.in Oct 25, 2016
Makefile.am Makefile: Add amcrest-tui to flake8 review Feb 2, 2017
README.rst Added IP3M-941W Jun 27, 2018
autogen.sh amcrest: rework to split the project Oct 27, 2016
configure.ac Bump version to 1.2.4 Jun 16, 2018
pylintrc Fixed a few lint problems Mar 16, 2017
python-amcrest.spec.in bump 1.1.9 Apr 16, 2017
requirements.txt Added urllib3 Mar 16, 2017
requirements_tests.txt Added first commit to organize unittests/coveralls.io/travis Mar 16, 2017
setup.cfg Updated description-file May 17, 2017
setup.py Bump version to 1.2.4 Jun 16, 2018
setup.py.in Updated long_description in the right file Jun 16, 2018
tox.ini Fixed lint (#93) Mar 6, 2018

README.rst

Python Amcrest

https://travis-ci.org/tchellomello/python-amcrest.svg?branch=master

A Python 2.7/3.x module for Amcrest Cameras using the SDK HTTP API.

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

Model Tested Status Results/Issues
IPM-721S Yes working  
IP2M-841B/841W/842W Yes working  
IP3M-956B Yes working  
IP3M-956E Yes working  
IP3M-956W Yes working  
IPM-HX1B Yes working  
IP3M-941/941W Yes working  
IP3M-HX2 Yes (partial) 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.