stevepedwards.com/DebianAdmin linux mint IT admin tips info

A Working ZoneMinder Pi Install With PiCam and Creative Optia Webcam in 10 Mins!

Another attempt at ZM on my original white Pi was almost painless! Getting the PiCam and Optia working was easy.

Looks like my last 5 days of solid research has finally paid off. Boy, did I go down some long, unnecessary paths before - but again - I learned a ton of stuff I would not have, just by following a How To like I've done below.

apt-get install zoneminder v4l-utils

ln -s /etc/zm/apache.conf /etc/apache2/conf.d/zm.conf

adduser www-data video

a2enmod cgi

PiCam - Add the v4l2 camera driver to /etc/modules so it loads at boot, then reboot:

echo "bcm2835-v4l2" >> /etc/modules

reboot

Check its loaded the v4l2 driver module:

lsmod | grep v4l2

v4l2-ctl -d /dev/video0 --list-formats

Optia

v4l2-ctl -d /dev/video1 --list-formats

PiCam

root@PiBlanc:~# v4l2-ctl -d /dev/video0 --list-framesizes=YUYV

ioctl: VIDIOC_ENUM_FRAMESIZES

Size: Stepwise 16x16 - 2592x1944 with step 2/2

Optia

root@PiBlanc:~# v4l2-ctl -d /dev/video1 --list-framesizes=YUYV

ioctl: VIDIOC_ENUM_FRAMESIZES

Size: Discrete 640x480

Size: Discrete 320x240

Size: Discrete 160x120

Size: Discrete 352x288

Size: Discrete 176x144

vi /etc/apache2/sites-enabled/000-default.conf

<VirtualHost *:80>

ServerAdmin webmaster@localhost

DocumentRoot /usr/share/zoneminder

<Directory />

Options FollowSymLinks

AllowOverride All

</Directory>

<Directory /usr/share/zoneminder>

Options Indexes FollowSymLinks MultiViews

AllowOverride All

Order allow,deny

allow from all

</Directory>

ScriptAlias /cgi-bin/ /usr/lib/cgi-bin/

<Directory "/usr/lib/cgi-bin">

AllowOverride All

Options +ExecCGI -MultiViews +SymLinksIfOwnerMatch

Order allow,deny

Allow from all

</Directory>

ErrorLog ${APACHE_LOG_DIR}/error.log

# Possible values include: debug, info, notice, warn, error, crit,

# alert, emerg.

LogLevel warn

CustomLog ${APACHE_LOG_DIR}/access.log combined

</VirtualHost>

Remove stale sockets and check ownership is www-data (who is in the video group anyway):

ls -als /tmp/zm/
total 8
4 drwx------ 2 www-data www-data 4096 Aug 9 14:10 .
4 drwxrwxrwt 7 root root 4096 Aug 9 14:09 ..

rm -vr /tmp/zm/zmdc.sock

service apache2 stop

service zoneminder start

service apache2 start

Don't use Chrome (except in Mint) or IE browsers. I used KMeleon. Firefox should work.

http://piblanc/

Add new Monitor1 for the Picam:

NOTE the DEVICE PATH!!! /dev/video needs the 0 and 1 added for each camera.

Depending on your camera model, start conservatively with low fps (say 10), small screen size and grey - unless you know your cam formats for sure from the tests above, and the option exists (e.g. YUYV), before experimenting.

Save.

If the Source link stays red there will be no comms so no image.

The Optia uses:

Now get colour on the Picam too:

Note the colour differences between camera types:

Later, changing the fps on the Optia to 15, the Pi crashed permanently on me, so I had to pull the plug.

Go easy on your settings.

Try larger frame sizes first - double to start e.g. from 320 x 240 to 640 x 480, before FPS increases.

Another major point to note is keeping settings uniform between devices if possible, as on a reboot the cameras swapped places in the /dev/video0/1 IDs.

Seems the USB BUS get read first over the PiCam BUS - whatever type it is...?

Also the cameras real time starts to lag badly - now 60 secs behind real time for an uptime of about 15 mins.

The clock times are different in the caption by 10 secs! Surely they should be reading the same Pi clock source?

Maybe that's a function of processing lag too...

I changed the bandwidth to high for my 100MB home network and the clock captions reset equally and the action lag is now about 1 second behind real time waving a hand in front. Much better!

Next major brainache...moving from monitoring to recording...

Comments are closed.

Post Navigation