Displaying multiple cameras on remote computers (Mini Howto)

Add any particular hints or tricks you have found to help with your ZoneMinder experience.
Post Reply
Flash_
Posts: 441
Joined: Wed Jan 11, 2006 12:19 pm

Displaying multiple cameras on remote computers (Mini Howto)

Post by Flash_ »

Displaying multiple cameras on remote computers (HTML, free, basic howto - Mjpeg only)

Note: This is NOT reliant on ZoneMinder, but I use these together. Zoneminder for recording, this for viewing. I use Axis IP cameras (they are excellent) but if you can get a mjpeg stream from ANY source, this should work. (With card-based cams you may need to stream from the server - zms? I'm unsure. Maybe someone with more knowledge about the normal cams can add on below this)

I spent a lot of time trying to get multiple camera images onto one webpage to display and refresh automatically. I looked at various webcam scripts - javascript, Java, ActiveX and dhtml options and none of them worked very well. The Java stuff was very slow and resource-hungry, ActiveX tied me to commercial software and dhtml/js just plain didn't work very well. After several hours of stress and dead-ending I tried something out of the blue and it worked.

The humble <img> tag...

Here's how it looks with six cameras:
Image
(PC running almost at idle displaying this, all pictures are 5fps/video (capped by camera))

This does NOT work in Internet Explorer. IE6 (don't know about the forthcoming 7) does not support mjpeg feeds.
Firefox, however, DOES. Possibly Opera too, but that's also commercial and I like using Firefox anyway. :)

What you need:
  • Camera capable of providing mjpeg streams. Note that if you're using a basic camera that can only supply one client, you won't be able to view it whilst ZM is also feeding, unless you use zms and get it from the server.
    Firefox (v.1.5 now - available for free from www.mozilla.org )
    A computer. Hardware demands are minimal. If Linux/windows, pc/mac. Possibly notebook/PDA if you can get Firefox to run.
    Some form of tcp/ip connection to the camera or streamer you're using. (Obviously)
    You DO NOT need a webserver or any other computer running.
All this is, is a basic html page that points to the camera's mjpeg feed in an <img> tag. Firefox renders the <img> as video and updates continuously. The speed of the connection and the camera/webserver self-limits how fast the frames are sent, but with 6 cams at 320x240 with a 5fps cap on the cameras, I get full motion on a Wifi-B (11mbps) connection. Viewing the same 6 over a 256k upstream on adsl, I see maybe 0.1 - 1fps.

So basically, create a html file using notepad or whatever. Save it on your own PC.
Code per image is something like this:

Code: Select all

<a href="http://10.0.0.1:80">  
<img src="http://10.0.0.1:80/axis-cgi/mjpg/video.cgi?resolution=320x240" width="320" height="240" border="0"> <br>
Camera 1</a> :: <a href="http://10.0.0.100/zm/index.php?view=watch&mid=2">Events</a> <br>
Front Gate
Replace 10.0.0.1:80 with the ip and port of your camera. The Link takes you to the ip camera's page so that clicking on it takes you to fullscreen, 1 camera. Optional.
Replace "/axis-cgi/mjpg/video.cgi?resolution=320x240" with the path to your camera's mjpeg feed.
Replace "http://10.0.0.100/zm/index.php?view=watch&mid=2" with the ip/path to that camera's ZoneMinder event list. Optional.

Open the html file in Firefox (File, Open).
That should display one camera. Adding more is simply a case of copying the html and changing to reflect each camera's details, arranging in frames or whatever.

Benefits:
Free software.
Resource light.
Upscaleable - as many cams/thumbnails as you can fit on one screen.
Flexible. (It's html)
Versatile. I have had up to 8 PC's all viewing the same cameras (Axis cams allow up to 20 simultaneous feeds, but fps might drop a bit). Zoneminder recording the cameras. Security guard has a laptop with him connected over wifi.
It's simple and reliable.

Drawbacks:
I don't know if it would work for MPEG streams, I suspect not but frankly haven't tried it.
You still need to go via the zoneminder server for cameras that cannot provide their own mjpeg streams. (I understand zms can stream in mjpeg format, but I've never used or learnt that - could be wrong!)

I don't take credit for this - the complicated bit is all done by Firefox. However, I wasted a lot of time trying to get this working using more complicated methods when they weren't needed simply because I didn't know Firefox could display motion video the same as a static image. I write this to make others aware of this - and that using Zoneminder (which is quite hungry when dealing with jpeg compression on ip-cameras) to view the images isn't always the best use of the equipment. There is no need to go through Zoneminder to monitor the images unless you want to and removing yourself from that link reduces the load on the ZM server (which with 6+ IP cams can be quite busy)
User avatar
zoneminder
Site Admin
Posts: 5215
Joined: Wed Jul 09, 2003 2:07 pm
Location: Bristol, UK
Contact:

Post by zoneminder »

Thanks for taking the time to put this up. I'm sure it took you a while to write and will be useful to users in the future.
Phil
jameswilson
Posts: 5111
Joined: Wed Jun 08, 2005 8:07 pm
Location: Midlands UK

Post by jameswilson »

I understand that this cant be used with ie as it doesnt directly support mpjpeg. BUt could it be used with normal jpegs and an autorefresh of say 5 seconds?
James Wilson

Disclaimer: The above is pure theory and may work on a good day with the wind behind it. etc etc.
http://www.securitywarehouse.co.uk
Flash_
Posts: 441
Joined: Wed Jan 11, 2006 12:19 pm

Post by Flash_ »

Probably, yes - combined with a no-cache tag so it forces a reload of the jpg's. Only downside I can think of is that it might be a bit flickery, but I've not tried it.
User avatar
zoneminder
Site Admin
Posts: 5215
Joined: Wed Jul 09, 2003 2:07 pm
Location: Bristol, UK
Contact:

Post by zoneminder »

You can use double buffering in javascript to eliminate any flickering. The ZM watch window does just this and it works pretty well.
Phil
Post Reply