跳转到主要内容

Amcrest摄像头的Python包装实现。

项目描述

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模块,使用SDK HTTP API为Amcrest摄像头。Amcrest和Dahua设备具有相似的固件。Dahua摄像头和NVR也支持此模块。

文档: http://python-amcrest.readthedocs.io/

安装

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

用法

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

命令行

$ 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

文本用户界面(TUI)

配置amcrest.conf并触发amcrest-tui,确保触发amcrest-tui的用户有权访问framebuffer设备或使用sudo。

注意:请从控制台登录执行,如 /dev/ttyX(非X Window)。xterm、ssh、screen 等伪终端将无法工作。

$ 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

支持矩阵

摄像机

型号

已测试

状态

结果/问题

IPM-721

正常工作

IPM-HX1

正常工作

IP2M-841

正常工作

IP2M-842

正常工作

IP3M-941

正常工作

IP3M-943

正常工作

IP3M-956

正常工作

IP3M-956E

正常工作

IP3M-HX2

正常工作

IP4M-1026B

正常工作

IP4M-1041B

正常工作

IP4M-1051B

正常工作

IP5M-1176EB

正常工作

IP8M-2496EB

正常工作

IP8M-T2499EW-28M

正常工作

网络视频录像机(NVR)

型号

已测试

状态

结果/问题

大华XVR 5104S

正常工作

如果您有不同的型号,请随时贡献并报告您的结果。

帮助

如果您需要任何帮助,请加入我们位于 Gitter 的社区。

项目详情


下载文件

下载适用于您平台的应用程序。如果您不确定选择哪个,请了解更多关于 安装包 的信息。

源分发

amcrest-1.9.8.tar.gz (43.6 kB 查看散列)

上传时间

构建分发

amcrest-1.9.8-py3-none-any.whl (54.8 kB 查看散列)

上传时间 Python 3

支持者

AWS AWS 云计算和安全赞助商 Datadog Datadog 监控 Fastly Fastly CDN Google Google 下载分析 Microsoft Microsoft PSF 赞助商 Pingdom Pingdom 监控 Sentry Sentry 错误记录 StatusPage StatusPage 状态页面