使用Logitech QuickCam Pro 5000在Debian上安装Zoneminder
将价值7英镑的网络摄像头变成一个简单的家庭监控系统。
安装Zoneminder
我们将使用32位Debian Wheezy VM。
更新系统并安装Zoneminder:
# apt-get update && apt-get upgrade -uV # apt-get install zoneminder
安装Apache Web服务器:
# apt-get install apache2
将Apache用户添加到视频组
网络服务器必须具备以下权限才能访问网络摄像头:
# ls -l /dev/video0 crw-rw---T 1 root video 81, 0 Dec 19 20:36 /dev/video0
将用户添加到补充组:
# usermod -aG video www-data
将Apache链接到Zoneminder
打开:
# vim /etc/zm/apache.conf
检查文件,如下所示:
Alias /zm /usr/share/zoneminder ScriptAlias /cgi-bin /usr/share/zoneminder/cgi-bin <Directory /usr/share/zoneminder> php_flag register_globals off Options FollowSymLinks <IfModule mod_dir.c> DirectoryIndex index.php </IfModule> </Directory>
链接Apache文件:
# ln -s /etc/zm/apache.conf /etc/apache2/conf.d/zoneminder.conf
可选:安装Cambozola Java插件
Cambozola是一个Java插件,可解码多部分JPEG流。
基于Mozilla的浏览器具有本机支持。
该插件用于缺少该支持的Internet Explorer之类的浏览器。
# cd /usr/src # wget http://www.andywilcock.com/code/cambozola/cambozola-latest.tar.gz # tar xzvf cambozola-latest.tar.gz # cp ./cambozola-0.935/dist/cambozola.jar /usr/share/zoneminder
找出Logitech QuickCam Pro 5000功能
查找设备编号:
# lsusb Bus 001 Device 001: ID 1d6b:0002 Linux Foundation 2.0 root hub Bus 002 Device 001: ID 1d6b:0001 Linux Foundation 1.1 root hub Bus 003 Device 001: ID 1d6b:0001 Linux Foundation 1.1 root hub Bus 004 Device 001: ID 1d6b:0001 Linux Foundation 1.1 root hub Bus 005 Device 001: ID 1d6b:0001 Linux Foundation 1.1 root hub Bus 001 Device 004: ID 046d:08c5 Logitech, Inc. QuickCam Pro 5000
获取供应商和产品代码(也可以从上面的输出中看到):
# lsusb -s 004 -v | grep id idVendor 0x046d Logitech, Inc. idProduct 0x08c5 QuickCam Pro 5000
获取支持的格式和分辨率:
# zmu -d /dev/video0 -vqV2 Video Device: /dev/video0 General Capabilities Driver: uvcvideo Card: UVC Camera (046d:08c5) Bus: usb-0000:00:1d.7-3 Version: 3.2.51 Type: 0x4000001 Supports video capture (X) Does not support video output Does not support frame buffer overlay Does not support VBI capture Does not support VBI output Does not support sliced VBI capture Does not support sliced VBI output Does not support video output overlay Does not have tuner Does not have audio in and/or out Does not have radio Does not support read/write i/o (X) Does not support async i/o Supports streaming i/o (X) Standards: Formats: MJPEG (MJPG) YUV 4:2:2 (YUYV) (YUYV) Crop Capabilities Bounds: 640 x 480 Default: 640 x 480 Inputs: 1 Input 0 Name: Camera 1 Type: Camera Audioset: 00000000 Standards: 0x0 Power on (X) Signal detected (X) Colour Signal detected Horizontal Lock detected
设置共享内存配置
我们的计算机上仅安装了1 GB或者内存:
# cat /proc/meminfo | grep -i memtotal MemTotal: 1022744 kB
因此,我们将SHMMAX设置为不超过一半或者物理内存512MB。
SHMMAX是单个共享内存段的最大大小(以字节为单位)。
要在正在运行的系统上更改值:
# echo 536870912 > /proc/sys/kernel/shmmax
永久更改:
# echo "kernel.shmmax = 536870912" >> /etc/sysctl.conf
SHMALL不会引起任何问题,因此不会被更改:
# cat /proc/sys/kernel/shmall 2097152
重新启动守护程序
# service apache2 restart # service zoneminder restart
将WebCam添加到Zoneminder WebUI
将Web浏览器导航到http://localhost/zm。
单击“添加新显示器”,Logitech QuickCam Pro 5000的设置如下所示。
可选的
在“系统”选项卡下,选中“验证用户对ZoneMinder的登录”框,以启用具有不同权限集的用户帐户的创建。
如果选择了较早安装,请在“图像”选项卡下,选中“是否安装了(可选)cambozola java流客户端”。
cambozola Java流客户端的路径应为“ cambozola.jar”。
在“图像”选项卡下,将“/usr/bin/ffmpeg”添加到“到(可选)ffmpeg mpeg编码器(?
)的路径”。
故障排除
# tail /var/log/messages # tail /var/log/syslog
还要检查Zoneminder WebUI上的“日志”部分。
一些修复
我注意到syslog的垃圾内容如下:
ERR [Shared data size conflict in shared_data for monitor L5000, expected 328, got 316]
打开“ /usr/share/perl5/ZoneMinder/Memory.pm”并更改以下内容:
#our $arch = int(3.2*length(~0)); our $arch = 32;
另一个:
ERR [Can't make events/1: Permission denied]
解决方法:
# chown -R www-data:www-data /var/cache/zoneminder/events # chown -R www-data:www-data /var/cache/zoneminder/images