Originally Posted by
Muffe
I do not want any motion detection, I just want to capture one picture every 60. second, and publish this on the internet. The way it is done now is that my linux server sends a HTTP request to the WL-500g in port 7776 for
display.jpg. It is stored on my computer, and the original is tranfered via FTP together with a resized copy to my webhost. Then is the copy on my computer deleted. This is done by a cron job executing a shell script every
60. second (if somebody is intrested in the script, please PM me).
What I want is something that can do the same job, with or without the help of my computer. I just want 640x480 pictures uploaded to my host every minute or any other apropriate interval.
I also need help to install the files provided by Tom
here. I have extracted the data.tar.gz and have
the files stored on my computer (running Linux), but what do I have to do now to reach my goal? It's not too much helpfiles og manuals attached, so it's a bit difficult for a newbee to understand it.
Below there was a request for step by step instruction, so here it goes.
I assume you have ASUS wl-500g, with custom software (Oleg's FW 1.9.2.7 CR4 or higher), you have web camera, supported by pwc driver. My configuration uses USB flash drive and while writing this HOWTO I realize that my configuration will not work without it, since size of all files to store is larger than 64K - maximum of flashfs to store. So you will also need USB flash drive supported by ASUS software or arrange dynamic load of gzipped archive from UNIX computer in post-boot. Anyway:
1. You need to download ipkg file provided by Tom here, uncompress and untar it, locate data.tar.gz extracted from package, uncompress and untar it. You may do this on other computer and then scp files to asus box, or do all on asus box, provided it is connected to Internet and you can ssh to it from your desktop. In the later case it looks smthg like (below I assume you've got USB flashdrive mounted in ASUS as /mnt):
Code:
[admin@router mnt]$ wget http://tom.stoeveken.com/programme/philips-webcam/philips-webcam_0.1_mipsel.ipk
Connecting to tom.stoeveken.com[213.203.199.171]:80
philips-webcam_0.1_m 100% |*****************************| 191 KB 00:00 ETA
[admin@router mnt]$ tar zxpvf philips-webcam_0.1_mipsel.ipk
./debian-binary
./data.tar.gz
./control.tar.gz
[admin@router mnt]$ tar zxpvf data.tar.gz
.
./www
./www/CamClient.class
./www/CamClient.html
./www/CamMonitor.class
./www/CamMonitor.html
./www/offline.jpg
./bin
./bin/mvc
./bin/setpwc
./bin/camsrv
./lib
./lib/modules
./lib/modules/2.4.20
./lib/modules/2.4.20/pwc.o
./lib/modules/2.4.20/pwcx.o
[admin@router 1]$ls -la
drwxr-sr-x 5 admin root 1024 May 18 01:06 .
drwxr-xr-x 5 admin root 13312 May 18 01:04 ..
drwxr-sr-x 2 admin root 1024 May 18 01:06 bin
-rw-r--r-- 1 1000 1000 399 Dec 23 21:46 control.tar.gz
-rw-r--r-- 1 1000 1000 195859 Dec 23 21:46 data.tar.gz
-rw-r--r-- 1 1000 1000 4 Dec 23 21:46 debian-binary
drwxr-sr-x 3 admin root 1024 May 18 01:06 lib
-rw-r--r-- 1 admin root 196314 May 18 01:05 philips-webcam_0.1_mipsel.ipk
drwxr-sr-x 2 admin root 1024 May 18 01:06 www
[admin@router mnt]$
Now you have all files necessary for the task inside the Asus box. To save space you may delete some files downloaded and extracted.
Code:
[admin@router mnt]$ rm philips-webcam_0.1_mipsel.ipk
[admin@router mnt]$ rm control.tar.gz
[admin@router mnt]$ rm data.tar.gz
[admin@router mnt]$ rm debian-binary
[admin@router mnt]$ rm -rf www
[admin@router mnt]$ rm bin/camsrv
[admin@router mnt]$ ls -lR
.:
drwxr-sr-x 2 admin root 1024 May 18 01:13 bin
drwxr-sr-x 3 admin root 1024 May 18 01:06 lib
./bin:
-rwxr-xr-x 1 admin root 109948 Dec 13 23:07 mvc
-rwxr-xr-x 1 admin root 23020 Dec 22 16:10 setpwc
./lib:
drwxr-sr-x 3 admin root 1024 May 18 01:06 modules
./lib/modules:
drwxr-sr-x 2 admin root 1024 May 18 01:06 2.4.20
./lib/modules/2.4.20:
-rw-r--r-- 1 admin root 69036 Dec 22 20:40 pwc.o
-rw-r--r-- 1 admin root 59310 Dec 22 20:40 pwcx.o
All these files will be necessary for out task, so it is better to keep it on USB flash drive.
2. Switch off webcam support in web interface of ASUS.
3. Create /usr/local/sbin/post-mount file with following lines in it.
Code:
#!/bin/sh
# device init
insmod videodev.o
# v4l device support
ln -s /dev/v4l/video0 /dev/video
# create "canonical" v4l device
insmod /mnt/lib/modules/2.4.20/pwc.o size=vga fps=4 power_save=0
# install pwc
# size= defines image size to capture
# fps= defines frames per second
# power_save= is some magic
insmod /mnt/lib/modules/2.4.20/pwcx.o
# install compression module
#Now lets sleep a bit...
sleep 30
# ... and start webcam software.
/mnt/bin/mvc -D -d /dev/video -t -w 2 -s 640x480 -c 70 -O /mnt/tmp/ -o -l /mnt/log/mvc.log
#
# this is my configuration, yours may vary
# -D Start mvc as a Daemon.
# -d device Specify v4l device (default: /dev/video0).
# -w delaytime Specify interval for each capture(seconds), Default: 0.5 second.
# -s XxY Specify the image capture size, default 320x240.
# -c value
# Specify threshold of block color difference. Range [0-765] Usu-
# ally, 30-200 is a better value for common use. More smaller more
# sensitive. Default value is 50
# Probably if you don't need motion detect at all -c 765 will switch it off
# -O directory
# Specify base directory for output images. default is current
# dir.
# -o Don't create sub-directories for output. Use this option, all
# image files will be put on one directory.
# -l logfile
# Specify the logfile name to be used in daemon mode. default is
# null.
#
# And now lets get Pid of mvc to kill it later.
# pid extraction
ps | grep "mvc " | grep -v 'grep' | sed -e 's/ admin.*//' -e 's/^ *//' >/var/run/mvc.pid
Let me stress again - basically this is my setup, using USB flashdrive to store data. Probably it is possible to start rcamd from flash instead of mvc, thus saving space and eliminating the need in usb flashdrive but I've never tried.
And don't forget to save resulting config (flashfs save && flashfs commit && flashfs enable)
4. Now we should arrange periodic image capture from mvc. To achieve this we will use USR1 signal, which cause mvc to save captured image (details may be found in http://www.turbolinux.com.cn/~merlin/mvc/README)
I use cron, but I only do 30 mins captures. So in my case I created shell script with following lines
Code:
kill -USR1 `cat /var/run/mvc.pid`
sleep 5
# file processing follows...
and add cron job to execute this script each half an hour (1 minute in your case). In file processing section I just scp file to remote computer to web accessible directory.
Another way of doing the same is running infinite loop in the end of post-mount with smthg similar to:
Code:
while true; do sleep 1800; killall -USR1 mvc; sleep 5; scp <scp instructions go here> ; done
(In this case you even do not need pid extraction in post-mount)
Probably I've missed some (important?) details here, but basically this is one of the possible ways to accomplish the task.
HTH
Roofcat
One off-topic question: Why is the image you supplied mirrored?
Because my Phillips camera provides me with mirrored image and I could not find simple way to config it the other way around. And I found difficult to flip it mentally all the time.