Text WebCam on Server

Introduction

The WebCam on Server provides the captured images to all connected clients.
Supported clients:

The captured WebCam image should be as small as possible to save bandwidth. This is especially important in case of connected mobile clients.


Setup

Text Object


  • Refresh must be set to zero
  • The WebCam option must be activated
  • The new captured image will be searched in the Image Path


Action


The action calls an external Capture Script for capturing a new snapshot image from the WebCam.
The Asynchrone option should be disabled for this action.


Action Control


This action will be called every second, fixed, with the state set to “webcam”.


Capture Script

The script must provide an image in JPEG format and should be as small as possible and must be smaller then 100kB.

Mac OS X

The wacaw –CIF option will generate a small image of 352 X 288. (Common Intermediate Format)

#!/bin/bash
echo "Snapping a new image of the webcam..."  
/Users/rob/Projects/Rocrail/unxbin/rocnet/webcam/wacaw -d 2 --jpeg --CIF /Users/rob/Projects/Rocrail/unxbin/rocnet/webcam/_picture
mv /Users/rob/Projects/Rocrail/unxbin/rocnet/webcam/_picture.jpeg /Users/rob/Projects/Rocrail/unxbin/rocnet/images/picture.jpg

Line explanation:

  1. The used interpreter
  2. Terminal message
  3. A call to the wacaw program to capture a new image
  4. move the captured image into the image path

Linux

#!/bin/bash
picfile="/home/sven/rocrail/images/$(basename "$0").jpg"
tmpfile="/home/sven/rocrail/images/_$(basename "$0").jpg"
device="/dev/video${0: -1}"
 
echo "Snapping a new picture from $device to $picfile"  
 
avconv -f video4linux2 -i "$device" -frames 1 "$tmpfile" 
mv "$tmpfile" "$picfile"

Windows

  • Example with all needed files and programs: webcam.zip

Personal Tools