low bandwidth

Low Bandwidth Zoneminder Stills On iPhone

The following will allow you to view your Zoneminder stills from the previous blog post on most web browsers including an iPhone. You need the stylesheet and expand settings if you plan on viewing stills through an iPhone without having to double-tap the image on every refresh. The php variable following ?time= is necessary to prevent Safari from displaying cached images.

Create a file called webcam1.php:

<html>
<head>
<meta HTTP-EQUIV="pragma" CONTENT="no-cache" />
<meta HTTP-EQUIV="cache-control" CONTENT="no-cache" />
<meta HTTP-EQUIV="refresh" CONTENT="5" URL="http://www.yourdomain.com/webcam1.php"/>
<meta HTTP-EQUIV="expires" CONTENT="-1" />
<link rel="stylesheet" type="text/css" href="style.css" />
</head>

<body>
<img src="webcam1.jpg?time=<?php $timestamp = strtotime('now'); echo $timestamp; ?>" class="expand" />
</body>
</html>

Create a file called style.css or append the following to your current stylesheet:

img.expand {
width: 100%;
}

Low Bandwidth Zoneminder Webcam Stills Using Inotifywait

This bash script will get the latest Zoneminder webcam images using inotifywait and copy it to a local or remote folder every 5 seconds. Implement this script when streaming is unnecessary and you don't want to expose your Zoneminder systems to the internet (low bandwidth monitoring and low disk space archival).

Notes: You must have inotify-tools installed: yum install inotify-tools. I use sshfs to automatically mount remote system folders.

#!/bin/bash

CAMDIR='/var/www/html/zm/events/1'

cd $CAMDIR

while LINE=$(inotifywait -rq --format %f -e create "$CAMDIR");
do
        CUREVENTDIR=`ls -r | head -n1`
        # Low bandwidth monitoring
        cp $CUREVENTDIR/$LINE /var/www/web1/webcam1_last.jpg
        # Archive to /home/webcam1
        cp $CUREVENTDIR/$LINE /home/webcam1
        # Archive using scp to user@192.168.3.2:/home/webcam1
        # scp $CUREVENTDIR/$LINE user@192.168.3.2:/home/webcam1
        echo "$CAMDIR/$CUREVENTDIR/$LINE"
        sleep 5
done
Syndicate content

© 2008-2010 Red Audit LLC.
Page generated in: 0.000173 seconds.