I have a DVR Camera System from Q-See. It is the QC444 DVR, it seemed like a good buy until I figured out how bad it is.
I published its problems on a yahoo group dedicated to hacking the Qsee. I republished them here
http://www.apolonio.com/node/19
One of the things I wanted to do was access this DVR securely over the Internet.
Well it bothered my a lot when I saw my credintials go over the Internet in clear text. Follow the link, the problems are too numerous to post here. My initial draft of this page included that post, but it made this page too long and too hard to read.
So I put it aside for several months, if I needed remote access, I would VPN in and view the cameras that way. But we are in a mobile world, I should be able to view this from my smart phone or tablet.
One option that the DVR offered was the ability to FTP the images off to another site. I took advantage of that but the first problem I had was that figuring out how the images where named on the FTP site.
It seem to upload them to
BASEDIR
DVR IP ADDRESS
DATE
CAMERA NUMBER
HOUR
and the name if the file would be
HOUR.MIN.SEC_R.jpg
So a normal image would be
/var/ftp/192.168.1.10/2012-01-03/001/22/22.20.38_R.jpg
Translated, DVR 192.168.1.10 uploaded a jpg file on Jan 3, 2012 10:20:38PM of Camera 1 named 22.20.38_R.jpg
So I created a script like so to copy the images from the FTP folder to the web folder.
#!/bin/bash
# Sleep needed to give QC a chance to FTP the images
sleep 10
find /var/ftp/192.168.1.10/`date -I`/001/`date +%H`/ -name "`date +%H.%M`*" -exec cp -f {} /var/www/html/qc444/cam1.jpg \;
find /var/ftp/192.168.1.10/`date -I`/002/`date +%H`/ -name "`date +%H.%M`*" -exec cp -f {} /var/www/html/qc444/cam2.jpg \;
find /var/ftp/192.168.1.10/`date -I`/003/`date +%H`/ -name "`date +%H.%M`*" -exec cp -f {} /var/www/html/qc444/cam3.jpg \;
find /var/ftp/192.168.1.10/`date -I`/004/`date +%H`/ -name "`date +%H.%M`*" -exec cp -f {} /var/www/html/qc444/cam4.jpg \;
# For some reason dav files are FTP'd too this deletes them
find /var/ftp -type f -name "*.dav" -exec rm -f {} \;
And added it to a cron job
* * * * * /home/serviceacct/bin/copymg.sh
That runs every minute
Amazing that it worked
Then created a cron job to clean up files older than an hour to run every 15 minutes
*/4 * * * * find /var/ftp/ -type f -mmin +60 -exec rm -f {} \;
Next created a web page to display the images with a refresh every minute
<HTML>
<HEAD>
<meta http-equiv="refresh" content="60">
<TITLE>DVR Cameras</TITLE>
</HEAD>
<BODY>
<TABLE>
<TR>
<TD><img height="240" width="352" src="/qc444/cam1.jpg"></TD><TD><img height="240" width="352" src="/qc444/cam2.jpg"></TD>
</TR><TR>
<TD><img height="240" width="352" src="/qc444/cam3.jpg"></TD><TD><img height="240" width="352" src="/qc444/cam4.jpg"></TD>
</TR>
</TABLE>
</BODY>
</HTML>
With those dimensions, it fit on my phone perfectly.
Finally secured it with SSL and Basic Authentication provided by Apache itself.
Theme by Danetsoft and Danang Probo Sayekti inspired by Maksimer