User Tools

Site Tools


text:text-webcam-server-en

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.

macOS

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

text/text-webcam-server-en.txt · Last modified: 2021/09/07 18:06 by rjversluis