Page 1 of 1

Capture for web cam images

Posted: Mon Oct 03, 2005 4:41 pm
by jlauman
I'm using ZM v1.21.3 with two 'local' cameras. I want to capture single frames from both cameras at 5 minute intervals and save them as different file names to a specified directory on the local drive so the they can be accessed via apache.

Can this be done? If so how... I haven't been able to find any information about doing something like this.

TIA

Jack

Posted: Mon Oct 03, 2005 8:28 pm
by zoneminder
You can't capture a a specific file name as such. Your best bet would be to set up your cameras in monitor mode and then just call the zmu binary (which can dump an image to a file) from a script or cronjob, and then just rename it yourself.

However you may find ZM is a bit of overkill for this and maybe you'll find something a bit more lightweight.

Phil

Posted: Mon Oct 03, 2005 8:46 pm
by jlauman
In the future they may want to have streaming video but for now all I need is two pics every five minutes.

What's the zmu command for this?

Thanks,

Jack

Posted: Mon Oct 03, 2005 9:04 pm
by cordel
From your web server you could do
http://192.168.xxx.yyy/cgi-bin/zm/zms?m ... &scale=100
Where mode requests a single jpeg image
monitor is the camera ID
You can create a script to get this url for your image.
Depending on your installation the url might be a bit differant depending on where you put zms and how you alias to it.
The other method I'm not aquainted with, put Phil could fill you in on it.
Regards,
Cordel

Posted: Mon Oct 03, 2005 9:31 pm
by zoneminder
If you do

Code: Select all

zmu --help
it will give you the full help. Actually I might as well post it.

Code: Select all

zmu <-d device_no> [-v] [function] [-U<username> -P<password>]
zmu <-m monitor_id> [-v] [function] [-U<username> -P<password>]
General options:
  -h, --help                     : This screen
  -v, --verbose                  : Produce more verbose output
Options for use with devices:
  -d, --device <device_no>       : Get the current video device settings for /dev/video<device_no>
  -q, --query                    : Query the current settings for the device
Options for use with monitors:
  -m, --monitor <monitor_id>     : Specify which monitor to address, default 1 if absent
  -q, --query                    : Query the current settings for the monitor
  -s, --state                    : Output the current monitor state, 0 = idle, 1 = alarm, 2 = alert
  -B, --brightness [value]       : Output the current brightness, set to value if given 
  -C, --contrast [value]         : Output the current contrast, set to value if given 
  -H, --hue [value]              : Output the current hue, set to value if given 
  -O, --colour [value]           : Output the current colour, set to value if given 
  -i, --image [image_index]      : Write captured image to disk as <monitor_name>.jpg, last image captured
                                   or specified ring buffer index if given.
  -S, --scale <scale_%ge>        : With --image specify any scaling (in %) to be applied to the image
  -t, --timestamp [image_index]  : Output captured image timestamp, last image captured or specified
                                   ring buffer index if given
  -R, --read_index               : Output ring buffer read index
  -W, --write_index              : Output ring buffer write index
  -e, --event                    : Output last event index
  -f, --fps                      : Output last Frames Per Second captured reading
  -z, --zones                    : Write last captured image overlaid with zones to <monitor_name>-Zones.jpg
  -a, --alarm                    : Force alarm in monitor, this will trigger recording until cancelled with -c
  -n, --noalarm                  : Force no alarms in monitor, this will prevent alarms until cancelled with -c
  -c, --cancel                   : Cancel a forced alarm/noalarm in monitor, required after being enabled with -a or -n
  -u, --suspend                  : Suspend detection, useful to prevent bogus alarms when panning etc
  -r, --resume                   : Resume detection after a suspend
  -U, --username <username>      : When running in authenticated mode the username and
  -P, --password <password>      : and password combination of the given user
  -A, --auth <authentication>    : Pass authentication hash string instead of user details
So essentially you would need to do

Code: Select all

zmu -m <monitor-id> -i
plus any authentication options necessary, to get the latest image dumped to the current directory, and named as above with your monitor name.

Phil

Posted: Sat Jan 07, 2006 11:01 pm
by Cylindric
I realise this is a bit of an old post, but I found a utility called "webcam" (comes with xawtv package) that does what you want, I think. (And is a bit simpler than ZM too)

It just runs, and FTPs a screengrab from a webcam to a certain location at regular intervals.

Create a file called .webcamrc in your home folder

Code: Select all

[grab]
       device = /dev/video0
       text = "webcam %Y-%m-%d %H:%M:%S"
       width = 320
       height = 240
       delay = 10
       wait = 5
       input = usb 

[ftp]
       host = ftp.myftpserver.com
       user = myusername
       pass = mypassword
       dir  = /somepath/img
       file = webcam.jpg
       tmp  = uploading.jpg
And then just type "webcam" from a console, and every 10 seconds it will upload a new grab.