Sunday, 3 July 2011

Multiple webcams on ZoneMinder (part 3)

Alternative page for ubuntu AMD64 / zoneminder:

Webcam log:

Install zoneminder
davidr@hgwells:~$ sudo apt-get install zoneminder
Follow normal instructions for a zoneminder .deb installation:
sudo ln -s /etc/zm/apache.conf /etc/apache2/conf.d/zoneminder.conf
 sudo apache2ctl restart
 sudo chmod 4755 /usr/bin/zmfix
 zmfix -a
 sudo chown www-data.www-data /usr/share/zoneminder/temp
 sudo vi /etc/sysctl.conf 
Add the following lines at the end of the file:
kernel.shmall = 250000000
kernel.shmmax = 250000000
Pick up shared memory changes:
sudo sysctl -p
kernel.shmall = 250000000
kernel.shmmax = 250000000
I have 4 identical cameras plugged in. The order of video0-video3 may change if other cams, etc are added.
davidr@hgwells:~$ ls /dev/video*
/dev/video0  /dev/video1  /dev/video2  /dev/video3
Rather than use the video0 devices, there is a more fixed set of device links in /dev/v4l/by-id and /dev/v4l/by-path.
NOTE: there is a bug in zoneminder that the device name is limited. For some of my cameras, the by-id or by-path was truncated, and zoneminder couldn't find it.
davidr@hgwells:~$ ls /dev/video*
/dev/video0  /dev/video1  /dev/video2  /dev/video3
davidr@hgwells:~$ ls /dev/v4l/by-path/
pci-0000:03:00.0-usb-0:2.1:1.0-video-index0
pci-0000:03:00.0-usb-0:2.2:1.0-video-index0
pci-0000:03:00.0-usb-0:2.3:1.0-video-index0
pci-0000:03:00.0-usb-0:2.4:1.0-video-index0
So, to get around this problem, define my own paths:
davidr@hgwells:~$ sudo mkdir /cam
davidr@hgwells:~$ sudo chmod 777 /cam
davidr@hgwells:~$ cd /cam
davidr@hgwells:/cam$ ln -s /dev/v4l/by-path/pci-0000\:03\:00.0-usb-0\:2.1\:1.0-video-index0 c1
davidr@hgwells:/cam$ ln -s /dev/v4l/by-path/pci-0000\:03\:00.0-usb-0\:2.2\:1.0-video-index0 c2
davidr@hgwells:/cam$ ln -s /dev/v4l/by-path/pci-0000\:03\:00.0-usb-0\:2.3\:1.0-video-index0 c3
davidr@hgwells:/cam$ ln -s /dev/v4l/by-path/pci-0000\:03\:00.0-usb-0\:2.4\:1.0-video-index0 c4
davidr@hgwells:/cam$ ls
c1  c2  c3  c4
davidr@hgwells:/cam$ 
Use a terminal window with
tail -f /tmp/zmdc.log 
to check for any zoneminder problems.
Open firefox to http:\\hgwells.local\zm to get to the web interface.

Add a new monitor. On the source tab, set the source to:
device : /cam/c1
PAL
YUUV
width:320
height:240

I was able to get two cameras up so far: 3 and 4 fail with dmesg :
[ 159.696321] usb 3-2.4: Not enough bandwidth for altsetting 3
[ 172.716216] usb 3-2.3: Not enough bandwidth for new device state.

Good info on USB in linux

* claim for 5 PS3 eye cameras with one USB3.0 card *

No comments: