ICamViewProxy – ICamView ZoneMinder MJPEG Server pda.cgi
Posted by: barkered in ICamView, ProjectsICamViewProxy has been updated.
I have purchased a ICamView Plus web server and compatible Infrared camera. These devices are relatively well built and the 2 together cost me as little as £40.
They are certainly not the best cameras in the world, but for that price the image quality and the functionality offered by the web server are very impressive.
The web server offers the following main features:
- Motion Detection
- Scheduled Recording
- Remote web interface
- SNMP
- Email and FTP alerting / uploading
- Multiple user accounts. I.E. view only, admin
- Single image URL (not MJPEG explained in more detail below)
- Video streaming port (proprietary explained in more detail below)
All sounds very good and for the price and it is. For myself though the image processing is overly simply and the only ‘tweaking’ parameter is a percentage of sensitivity. Which is pretty pointless and useless. Ideally I would like to be able to monitor a single ‘zone’ and ignore motion detection outside the zone.
My next step was to try and connect this IP Camera into zoneminder to give me the motion detection and alerting system I required. Simple I assumed.. How wrong I was.
Image URL
The single image URL provided by the web server is appallingly unreliable. Request an image via the constructed URL and sometimes get a JPEG, sometimes an error and often nothing.
http://IPADDRESS:VIDEOPORT/pda.cgi?user=&password=&page=image&cam=1
‘user=’ is an anonymous viewer
‘user=admin’ would be an admin user
similar goes for ‘password=’
Video Port
Unfortunately the video port is a proprietary authenticated protocol based on UDP, not a MJPEG stream. I cannot understand the logic here, it would make far more sense to provide an MJPEG stream.
To connect to zone minder an MJPEG stream is required. This is where my proxy application comes in.
After a bit of googling, some reverse engineering of the protocol using wireshark to capture the packets sent from the windows application to the web server and some coding I have a working solution which logs into the web server video port and requests an image every 1000/FPS ms. I found Neil Raymond’s application a great starting point. So if you are reading this, thank you!
The application sits on the box running zoneminder and provides a proxy between the proprietary video port and provides an MJPEG stream to zoneminder. In an ideal world, ICamView would make a complient port, but given their releases of updates it seems unlikely.
The application is fully portable and has been written using C++, SDL and SDL_net extension. I have compiled and tested it in windows and Linux (Fedora 6). There is no reason why this should not work on any other platform.
Usage Instructions:
Simple really:
ICamViewProxy -camid 1 -camhost 192.168.1.3 -camport 9001 -camuser user -campass password -proxyport 8888
Download
The source is working source and as such may not be considered production code. This could be easily turned into a daemon with an init script in Linux.
This will happily cross compile, the zip file contains a working windows binary and also the required dependencies for windows compilation. This should build out of the box on visual studio 2008.
ICamViewProxy has been placed onto GitHub for further development, feel free to send me patches.
Any questions, bugs, suggestions feel free to get in contact.



Entries (RSS)
August 7th, 2008 at 9:01 pm - Edit
Previous comments, I was unable to import them so I have posted them as one.
# Rick says:
March 9th, 2008 at 1:19 pm – Edit
Hi,
Would really like to get IcamViewProxy working, but I can’t compile on linux and Win32 just scrolls accept 1, accept 2 etc….
Any chance of some advice to get this working with ZM??
# Luka says:
April 23rd, 2008 at 9:17 pm – Edit
Hello.
When i input ./linux_build.sh i get a response that says “./linux_build.sh: line 1: g++: command not found”…
I’m pretty stuck now:) Any ideas?
Best regards,
Luka
# W. Bertels says:
April 27th, 2008 at 7:43 pm – Edit
Hi all,
I finally succeeded in compiling and running the proxy. A few pitfalls which costed me about two days (I’m not an experienced developer), so maybe you can benefit from what I found out.
Tip Compiling: requires not only SDL and SDL_net but also the development modules, which weren’t installed automatically when I did an install for SDL with yum. I had to specifically: yum install SDL-devel* and yum install SDL_net-devel*
Tip Running: In my case the SDL_net modules were placed at /usr/local/lib, whereas the SDL modules were placed at /usr/lib which is also where ICamViewProxy seems to look for them. I copied the libfiles to overcome the missing lib message.
Question1: I have two camara’s running on a single IcamView device. How do I access the second camera?
Question2: The proxy outputs status information on the prompt. How do I get rid of this. It prevents me from closing the session.
# Barkered says:
April 27th, 2008 at 10:29 pm – Edit
Hi guys, sorry I have been so very busy recently. I will reply to your emails soon and update this page with additional information on compiling, installing and using icamviewproxy.
I forget not everyone is a developer, so things I take for granted are not as easy for everyone.
Tom
# W. Bertels says:
April 30th, 2008 at 8:57 am – Edit
I have succeeded in compiling a seperate version of the proxy for the second camera.
Just change ICamViewSocket.cpp :
//cam id, should really be configurable.
pLogin->data[byteid++] = ‘0?;
pLogin->data[byteid++] = ‘1?;
to
//cam id, should really be configurable.
pLogin->data[byteid++] = ‘0?;
pLogin->data[byteid++] = ‘2?;
I now have 5 proxies running for 5 cams. It puts quite a load on the system, so I’m still looking for tuning points. Is there an extra penalty for running 5 seperate proxies. Would it be more efficient if these could be combined?
August 10th, 2008 at 11:01 pm - Edit
[...] ICamViewProxy explaination and download Tags: ICamView, Proxy, ZoneMinder [...]
November 21st, 2008 at 5:19 am - Edit
Hi guys,
i need some help here. i am not good in vs c++ but i need to get your program run from my side. i have an error of could not open include file: ‘SDL.h’: no such file or directory. may i know how can i add the SDL.h to my vs.net 2003?
Please advice. thanks
Cheers
jordon
December 7th, 2008 at 12:24 pm - Edit
To build in Ubuntu (I used 8.10)
get dependencies
sudo apt-get install libsdl1.2debian libsdl1.2-dev libsdl-net1.2 libsdl-net1.2-dev
chmod +x linux_build.sh
./linux_build.sh
and you’re off (for some reason executable has a ? mark on the end..)
./ICamViewProxy? -camhost 192.168.2.1 -camport 9001 -camuser admin -campass xxx -proxyport 8888
April 2nd, 2009 at 10:27 am - Edit
The ICamViewProxy works just fine with ASUS CX200 IP camera (it use iCamView clone inside)! Tried with both WinXP and Linux (Ubuntu 8.04.2).
Great done!
December 17th, 2009 at 3:08 am - Edit
Hi,
Where can I find the following for Ubuntu environment?
SDL SDL_net SDL-devel* SDL_net-devel*
Thanks for your work,
Rich
January 3rd, 2010 at 12:53 am - Edit
Hi,
You should be able to find everything you need here: http://www.libsdl.org/
Ubuntu like any linux distribution should have these packages in their package manager though. Unfortunately I do not use ubuntu so I cannot say where you can find them. But they are very common and should be easy to add.
Thanks
January 3rd, 2010 at 1:40 pm - Edit
I had to make some changes to have it work with my own ICamView – a different request code and image header is used. I have hardware ‘HCAMV’ and firmware ‘2.37.CAMV’.
Where do you want the patches? I didn’t make it configurable yet – but if you don’t have it in public version control anywhere, shall we make a couple of branches on github?
Thanks!
Nick
February 12th, 2010 at 6:32 pm - Edit
Hi Barkered.
I’m trying to connect a IP camera (which is using the firmware 2.55.CV73.8731) using your proxy (nice job). But it’s not working.
I follow your tutorial, i compiled the linux_build.sh and execute the proxy with the following sentence :
./ICamViewProxy? -camhost -camport -camuser -campass -proxyport 8888
It doesn’t display any error or warning so it seems it is working. The doubt I have is with the zoneminder configuration. On your tutorial, you put a different IP for the remote host. Should I put here the Server (where zoneminder & proxy are) IP?
When I do this, the proxy program start dispallying a counter called Attempt, and i still dont get any image from the camara. I thought it can also be the path of the images I put “image” as your tutorial says.
I’m using zoneminder 1.24.1 hope you an give me a clue to a possible solution or the solution to this problem.
Thanks
February 12th, 2010 at 6:36 pm - Edit
Sorry, I the html tags paly me a joke writting the command I put in my previous post. The command I use has this format.
./ICamViewProxy? -camhost (Camera IP) -camport (Camera port) -camuser (User) -campass (Password) -proxyport 8888
Sorry for the double post and thanks.
February 15th, 2010 at 10:51 pm - Edit
New version released, comments incorporated, new source to add additional functionality.
April 13th, 2010 at 7:01 pm - Edit
Hi,
New to compiling. No errors shown on screen after running linux_build.sh as SUDO under Ubuntu.
However, it created an object called ICamViewProxy? What does that mean when its name ends with a question mark?
Thanks,Rich
April 14th, 2010 at 3:04 am - Edit
Can anyone tell me how to use ICamViewProxy with ZoneMinder?
I have renamed ICamViewProxy? to ICamViewProxy and it seems to run.
Thanks,
Rich
June 13th, 2010 at 1:32 am - Edit
I love it!
July 10th, 2010 at 5:54 pm - Edit
Will it also work with motion?
August 17th, 2010 at 11:04 pm - Edit
I have tried this with motion, no joy up to now… would love to get it working.
[0] Thread 1 is device: http://127.0.0.1:8888/ input -1
[1] Camera thread starting…
[1] Error reading first header – re-trying
[1] Error reading first header – re-trying
[1] Error reading first header – re-trying
[1] Error reading first header – re-trying
[1] Error reading first header – re-trying
[1] Failed to read first camera header – giving up for now
Any help would be great.
August 18th, 2010 at 8:46 pm - Edit
Upon trying some more I have managed to get this working with motion.
I ran into problems with testing from my local machine as well as motion trying to connect. A bit of patience is all was required.
Thank you for this great tool.