ZoneMinder Browser Streaming

Got Zoneminder installed and running again. alot of fine tuning to be done, but so far so good.
Here’s the current setup:-
Ubuntu 11.04
Anykeeper 2016 Card
Zoneminder 1.24.2
6 Cameras connected
only 1 of the anykeeper cards in atm.

The anykeeper card isn’t exactly stable, 2 of the images are light flickering not a clue why they’ve been stable with this card before under windows and another card so guessing it’s down to the mix of card and config. I can live with it though as it doesn’t setoff the motion you can just see it pulsing when on live view.

Think I’ll be ordering another card though that is known to work with zoneminder, having something nice and stable would be nice.

One thing that has been bugging me though is the streaming options. When using Chrome I’ve had to manually select Yes on the Can_Stream to kick in the live view as the auto just sits there.
However I found this http://www.zoneminder.com/forums/viewtopic.php?t=15429
Incase it gets removed I’ll copy the instruction below

In file include/functions.php, change the following which is at around line 823 (May vary from installation to installation): 

Code:
    elseif (ereg( ‘Opera ([0-9].[0-9]{1,2})’,$_SERVER[‘HTTP_USER_AGENT’],$logVersion))


To:

Code:
    elseif (ereg( ‘Opera/([0-9].[0-9]{1,2})’,$_SERVER[‘HTTP_USER_AGENT’],$logVersion))




In around line 876 (May vary from installation to installation), change:

Code:
function canStreamNative()
{
   return( ZM_CAN_STREAM == “yes” || ( ZM_CAN_STREAM == “auto” && (isNetscape() || isKonqueror()) ) );
}


To:

Code:
function canStreamNative()
{
   return( ZM_CAN_STREAM == “yes” || ( ZM_CAN_STREAM == “auto” && (isNetscape() || isKonqueror() || isOpera() || isSafari()) ) );
}




In around line 840 (May vary from installation to installation), find this:

Code:
function isNetscape()
{
    getBrowser( $browser, $version );

    return( $browser == “mozilla” );
}


Add this below it or above it:

Code:
function isOpera() {
    getBrowser( $browser, $version );
    return( $browser == “opera” );
}
function isSafari() {
    getBrowser( $browser, $version );
    return( $browser == “safari” );
}

 Next I have to get the PTZ up and running. Will post up my solution to that one as so far I’ve had no joy.

Sync Timstamp in Linux

First you have to run something along the lines of:-

find . -type f -print -exec stat -t -c '%y' {} ; > /tmp/original_dates.txt

On the first set of files, the ones with the correct time.
Once that is complete you run:-

cat /tmp/original_dates.txt | (while read FILE && read DATE; do echo $FILE; echo $DATE; DATE2=`date -d "$DATE" +%Y%m%d%H%M.%S`; touch -t $DATE2 "$FILE"; done)

On the second set of files. This will then set their date as the original.

OpenVPN Connection Sever 2 Server Ubuntu

I’ve got a few VPN links in place using OpenVPN and thought it’s about time I documented how incase something goes wrong in the future.

First was the install:-

apt-get install openvpn

Once installed:-

cd /etc/openvpn

Then Generate a key using:-

openvpn --genkey --secret static.key

Create the config file using:-

nano -w server2.conf
remote server2.example.co.uk
float
port 8008
dev tun203
ifconfig 192.168.204.203 192.168.203.204
proto udp
persist-tun
persist-local-ip
persist-remote-ip
comp-lzo
ping 15
secret /etc/openvpn/static.key
;route 192.168.203.0 255.255.255.0
chroot /var/empty
user nobody
group nogroup
log vpn.log
verb 0

Things that need changing are the server address and the local and remote IP addresses. Also check the chroot, user and group exist.
Next copy the static.key from server1 to server2. Then create a server1.conf in /etc/openvpn/

nano -w server1.conf
remote server1.example.co.uk
float
port 8008
dev tun203
ifconfig 192.168.203.204 192.168.204.203
proto udp
persist-tun
persist-local-ip
persist-remote-ip
comp-lzo
ping 15
secret /etc/openvpn/static.key
;route 192.168.204.0 255.255.255.0
chroot /var/empty
user nobody
group nogroup
log vpn.log
verb 0

Notice how the IP configuration on this server is reversed. These IP addresses are just used by the tunnel and do not have to be within your normal network range. However for routing to multiple network segments it seemed easier to keep these addresses within the network range for me so it’s easier to trace where the fault lies if something goes wrong.
Last thing to check is that ip_forwarding is also enabled

cat /proc/sys/net/ipv4/ip_forward

Once the connections are established, it’s probably worth having some routing info pushed to each server. For simple routing you can uncomment the option in the configs above. For more advanced routing it’s worth installing Quagga.

I’ll need to update this with better details on what the configs do. But that’ll get it running in a simple setup.

Ubuntu 10.10 and Chrome Missing Plugins

Re-installed my laptop about a week ago with Ubuntu 10.10. Finally killed off the Windows partition that wasn’t working properly anyway. So took the opportunity to install a fresh Ubuntu 10.10 with disk encryption. Everything seemed to be working fine. that is except Chrome.
I couldn’t access my CCTV system using chrome like I used to. If you access it from Windows IE you get a nice little request whether to load the mpeg viewer or access jpeg stills. But never had that prompt in Chrome after auth it just loads up an image viewer that’s opens up a single camera view.

But now I’m just stuck with ‘Missing Plugin’ in a nice grey box. I’ve already loaded up Flash, Quicktime, VLC, and a few other plugins and video playback works. but the CCTV just didn’t! It was bugging me, but I’d just kinda left it. Tonight though I ended up installing ZoneMinder for someone, and after a few permissions problems finally got the camera up and running, but it was doing a simple jpeg image refresh every 5 secs. I remembered from a few years ago downloading cambozola(?).jar so went looking and found it. Installed it and tried again, boom ‘Missing Plugin’.

After some searching I found that there’s an option in Zoneminder to change Options > Images > CAN_STREAM it’s normally set on Auto. but if you change it to Yes, it makes the ‘Missing Plugin’ in Chrome go away.

But this isn’t a solution to me as my own CCTV is old software that almost certainly doesn’t have an option in anyway similar. So onto more searching for jpeg streaming chrome and ubuntu. By chance I stumbled onto a java site and oh look ‘Missing Plugin’ again.

Of course it is, I haven’t installed Java yet, DOH!

A quick search of the Ubuntu software and I installed the OpenJDK Java 6 Runtime. Restarted Chrome and it’s still not working. Uninstalled OpenJDK and then went off doing a manual install of Java and creating a symbolic link of the necessary files into the Chrome directory alongside the Flash and Quicktime plugins. But it still doesn’t work.

So back to the drawing board. Removed all the manual stuff and back to installing OpenJDK Java 6 Runtime via the Ubuntu Software. Then I also installed iced6tea-plugin. Yahoo it works. I now have access to my CCTV again using Chrome on Ubuntu.

So Bottom Line:-
If your getting ‘Missing Plugin’ messages in Chrome, make sure you have Java installed.
Ubuntu Software >
OpenJDK Java 6 Runtime
icedtea6-plugin

Setting Up My Blog

Well been meaning to do this for a while, just couldn’t get around to either setting stuff up on my own server or researching a good blog site.
But tonight google decided to take all that hassle away from me by asking if I wanted to upgrade my domain account and let my users login to other services. So hey presto access to a load of google apps at the click of a button.
It’s still taken me about 10 mins trying to pick out a design and template though. I’m not exactly convinced it looks any good yet though. Time will tell.

Hopefully I’m going to stick stuff on here about Linux, Asterisk, Nagios, Scripting and a load of scraps that I need to write down so I can find them again, which maybe of use to someone.