License: GPLv2
Author: Merlin Ma<merlin@turbolinux.com.cn>
URL:
http://www.turbolinux.com.cn/~merlin/mvc/
Description:
MVC is a text mode v4l video capture program that features motion
detection. It is very small and easy to use, and could be used to
monitor and record the peoples that enter your room.
Ther v4l part of this program referenced code vidcat.c
which comes from w3cam. w3cam is an excellent CGI program
by Rasca<fcii@gmx.de>
URL for webcam is:
http://home.pages.de/~rasca/w3cam/
Its motion detection algorithm is designed by me.
Build:
In source directory, just type 'make'.
To change default settings, modify config.h, then rebuild.
To build rpm, just type rpmbuild -ta mvc-0.8.6.tar.gz
Install: type 'make install'
Usage: mvc [options]
Options are:
-B brightness
Specify picture brightness value.
-C contrast
Specify picture contrast value.
-D Start mvc as a Daemon.
-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.
-t Print timestamp on output image.
-d device
Specify v4l device (default: /dev/video0).
-e program
excute a external program while motion detected.
-f {jpeg|png}
Select output file format. default is jpeg.
-i channel
Specify the v4l device input channel number to use. The first
input is 0, and the second input is 1, etc. Usually, for bttv
card, input 0 is used for TV, input 1 is composite1, input 2 is
composite2 and input 3 is a S-Video port.
The default value of this option is depend on how many input
channel the device have. If the device only have one input (like
ov511 webcam), it will be used as default input. If the device
have more than 1 port (such bttv driver), mvc will use channel
number 1 as default, because channel number 0 often used as TV
input, so, skip it.
-m use mono color (grayscale) for capture.
-n {pal|ntsc|secam|auto}
Specify the video norm of input signal, default: PAL
-s XxY Specify the image capture size, default 320x240. Example: -s
640x480
-a HxV Specify the division number for image process in Horizantal and
Vertical. default is 16x8. Usually, up to 32x16 blocks is good
enough for common use. Example: -a 32x8
-b number
Specify threshold of hot block number. Range: from 1 to total
splited blocks. Usually, 1% - 10% of total blocks is a good
choice, for example: the image divide by 32x8 in x-direction and
y-direction, total blocks is 32*8=256. Then, 256*0.01=3 to
256*0.1=25 is a better choice range. Default value is total
blocks/64+1, In above case, this value is 32*8/64 + 1 = 5. More
smaller value more sensitive for smaller and farther object
detection.
-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.
-q quality
Specify jpeg quality value [1-100], default: 90.
-w delaytime
Specify interval for each capture(seconds), Default: 0.5 second.
Suggest: 0.2-2, Default value is 0.5 second.
Example: -w 1
-l logfile
Specify the logfile name to be used in daemon mode. default is
null.
-h Print brief help.
-v Increase verbose level, it can be multiple applied for more and
more debug info.
By default, if run mvc without parameters, it will use /dev/video0 as
v4l device, Composite1 as input, PAL norm, picture size 320x240, color mode,
block division is 16x8, hotblock threshold is total blocks/64+1, in this
case is 16*8/64+1=3, color diff threshold is 50, if use mono color,
suggest use -c 25, delay time is 0.5 second between each capture, program
run in foreground. All image files will be saved in directory named by
date and file named by time, such as ./2003-06-20/18/img-182633-0.jpg.
If you start program in foreground, you still can switch it into daemon
mode just by pressing Ctrl-Z. So, you can then logout from your terminal,
the program will run in background and log all message into the file
specified by -l option, by default, all message will be dropped.
Examples:
1. Write all files and subdirectories into /home/httpd/html/pics, and
use ntsc norm for input signal.
mvc -O /home/httpd/html/pics -n ntsc
It will automatically create date named sub-directories and store
images in them.
2. Run mvc in Daemon mode and log all message into /var/log/mvc.log,
and use png for output file format.
mvc -D -l /var/log/mvc.log -f png
3. If you have 2 capture card, you could use them at same time by
starting 2 copies of mvc like this:
mvc -D -l /var/log/mvc0.log -d /dev/video0 -O /home/mvc/myroom
mvc -D -l /var/log/mvc1.log -d /dev/video1 -O /home/mvc/garden
So, device video0 output to directory /home/mvc/myroom/, and
device video1 output to directory /home/mvc/garden/.
4. If you don't want to put image files in time-named subdirectories
separately, use -o option.
mvc -O /tmp/mvc/ -o -i 2 -s 640x480
This will put all captured images in /tmp/mvc, and don't create
sub-dir such as /tmp/mvc/2003-06-22/21/, image will be stored
in same directory - /tmp/mvc and named as img-20030622-215501.jpg.
Use comp2 port as input and image size 640 x 480.
5. Use -vvv option to active detailed debug info for your -b and -c
reference.
mvc -n PAL -s 640x480 -a 20x10 -vvv
6. If you want to execute your own program while motion detected,
use -e option like this:
Assume there is a program named beep, it make alarm sound. Run
'beep 1' to start alarm, and 'beep 0' to stop the alarm.
So, if we want make 20 second alarm while motion detected, start
mvc like this:
mvc -n PAL -e 'beep 1; sleep 20; beep 0'
while alarm, mvc still do captures by its default interval. And,
before the command line is finished, mvc does not start another
copy of user program. It is useful for avoid the program stacked.
7. If there are any other assistant program used to detect the inbreak,
for example: Infrared sensor, Doppler sensor, or we just want to
do a hourly capture whatever if motion detected or not.
Just send a USR1 signal to the mvc process to force one capture.
Use 'killall -USR1 mvc' under command line, or
use kill(mvcpid, SIGUSR1) in your program is ok.
Do a half-hourly capture:
shell> while true; do sleep 1800; killall -USR1 mvc; done
8. If you want to show time and date on image, use -t option,
it will print capture time on image.