Jun 182015
 

Pi_insideJust some useful commands:

  • Make sure your RPI is up to date:
sudo apt-get install rpi-update
sudo rpi-update
sudo apt-get update
sudo apt-get upgrade
  • Check capabilities:
vcgencmd codec_enabled MPG2
vcgencmd codec_enabled WVC1

vcgencmd version

Jun 17 2015 13:36:16
Copyright (c) 2012 Broadcom
version 1352d17ed6bd078120ac262b8c45b5b3a0d398de (clean) (release)

  • Streaming of USB video camera:

Start streaming on Pi:

cvlc v4l2:///dev/video0 --v4l2-width 640 --v4l2-height 480 --v4l2-chroma h264 --sout '#standard{access=http,mux=ts,dst=0.0.0.0:8080}

Start watching on client:

cvlc http://10.6.23.101:8080

Bonus, autostart streaming at boot:

Add streaming line to script
sudo chmod +x /home/pi/bin/stream.sh
crontab -e
@reboot /home/pi/bin/stream.sh
  • Configure WLAN
sudo vim /etc/network/interfaces
allow-hotplug wlan0
iface wlan0 inet dhcp
wpa-ssid "YOUR NETWORK SSID"
wpa-psk "WIFI PASSWORD"
sudo reboot

Or install wicd-curses and wicd-daemon

 


 

Jun 162015
 

Intro

Sadly, Zoneminder is not available in Debian 8. Here you can find my recipe for building debian package and installing Zoneminder, currently version 1.28.1 from git. Based on slightly amended instructions for Debian 8 Jessie from README.md

insta-16

Prerequisite

aptitude install -y apache2 mysql-server php5 php5-mysql build-essential libmysqlclient-dev libssl-dev libbz2-dev libpcre3-dev libdbi-perl libarchive-zip-perl libdate-manip-perl libdevice-serialport-perl libmime-perl libpcre3 libwww-perl libdbd-mysql-perl libsys-mmap-perl yasm automake autoconf libjpeg8 apache2-mpm-prefork libapache2-mod-php5 php5-cli libphp-serialization-perl libavcodec-dev libavformat-dev libswscale-dev libavutil-dev libv4l-dev libtool ffmpeg libnetpbm10-dev libavdevice-dev libmime-lite-perl dh-autoreconf dpatch

Build

cd /usr/src
git clone https://github.com/ZoneMinder/ZoneMinder.git zoneminder;
cd zoneminder
ln -s distros/debian8 debian
dpkg-checkbuilddeps # and apt install if anything is missing

vim zoneminder/debian/changelog # add new version on top with email address matching your GPG key and then

dpkg-buildpackage

 

Installation

One level above should hopefully find a deb package matching the architecture of the build host:

ls -l /usr/src/zoneminder*.deb
cd /usr/src
for i in `ls *.deb`;do echo "------------- $i";dpkg -i $i;done
apt-get install -f
dpkg-reconfigure zoneminder

 

Lets see:

systemctl status zoneminder

 zoneminder.service - ZoneMinder CCTV recording and security system
 Loaded: loaded (/lib/systemd/system/zoneminder.service; enabled)
 Active: active (running) since Tue 2015-06-16 13:28:12 BST; 3min 21s ago
 Main PID: 5602 (zmdc.pl)
 CGroup: /system.slice/zoneminder.service
 /usr/bin/perl -wT /usr/bin/zmdc.pl startup
 /usr/bin/perl -wT /usr/bin/zmfilter.pl
 /usr/bin/perl -wT /usr/bin/zmaudit.pl -c
 /usr/bin/perl -wT /usr/bin/zmwatch.pl
 /usr/bin/perl -w /usr/bin/zmupdate.pl -c
 Jun 16 13:28:11 sambor.home zmdc[5632]: INF ['zmaudit.pl -c' started at 15/06/16 13:28:11]
 Jun 16 13:28:11 sambor.home zmfilter[5626]: INF [Scanning for events]
 Jun 16 13:28:11 sambor.home zmdc[5638]: INF ['zmwatch.pl' started at 15/06/16 13:28:11]
 Jun 16 13:28:11 sambor.home zmdc[5602]: INF ['zmwatch.pl' starting at 15/06/16 13:28:11, pid = 5638]
 Jun 16 13:28:12 sambor.home zmwatch[5638]: INF [Watchdog starting]
 Jun 16 13:28:12 sambor.home zmwatch[5638]: INF [Watchdog pausing for 30 seconds]
 Jun 16 13:28:12 sambor.home zmdc[5602]: INF ['zmupdate.pl -c' starting at 15/06/16 13:28:12, pid = 5645]
 Jun 16 13:28:12 sambor.home zmdc[5645]: INF ['zmupdate.pl -c' started at 15/06/16 13:28:12]
 Jun 16 13:28:12 sambor.home zmupdate[5645]: INF [Checking for updates]
 Jun 16 13:28:12 sambor.home zmupdate[5645]: INF [Got version: '1.28.1']

Well, well, well. Look who’s up and running!

Configuration

Alright, we can now connect to server IP address and start adding monitors

http://10.10.0.231/zm/index.php

Start with checking your cameras:

zmu -d /dev/video0 -q -v

It took me a while to experiment with settings and find the most optimal configuration. My camera is connected via BT878 video card and it worked with

Capture Method v4l2
 Device Channel 1
 Device Format NTSC
 Capture Pallet Auto
 Target Colorspace 32bit
 Capture Width 768
 Capture Height 480
 # although Crop Capabilities in debug advertised it as 924 x 576
 

I use it in Mocord mode.

Last hint, make sure you have plenty of space to store data produced by Zoneminder.
I have changed symlinks /usr/share/zoneminder/{events,images,temp} and pointed them to dedicated zfs filesystem with ample of space:

for i in events images temp;do mkdir /tank/zoneminder/$i;ln -s /tank/zoneminder/$i /usr/share/zoneminder/$i:done
 chown www-data. /tank/zoneminder/*

Logging

Is default Zoneminder inclination to log bloody EVERYTHING to blooming EVERYWHERE driving you mad? Well, welcome to the club!

vim /etc/rsyslog.conf

and replace line 62 adding local1.!*

# *.*;auth,authpriv.none -/var/log/syslog
# As per http://www.zoneminder.com/wiki/index.php/Documentation#Logging
*.*;local1.!*;auth,authpriv.none -/var/log/syslog

And restart rsyslog

systemctl restart rsyslog