Capture bash script

The final piece to get my eeepc to take pictures periodically was to wrap up the vlc (see Webcam capture using vlc) and crontab (see Crontab) stuff in a bash script. This is a way of making scripts for the Unix shell which is default on many distributions and certainly on Ununtu.

This is the script I entitled capture.sh, put in my bash_scripts folder and referred to with the crontab:

#!/bin/bash

cd $HOME/captures

D1=`date +%Y-%m-%d`
D2=`date +%Y%m%d_%H-%M_`

# If the date directory does not exist, create it
if [ ! -d $D1 ] ; then
mkdir -p $D1
fi

#cd to this new directory
cd $HOME/captures/$D1

# capture images using vlc
cvlc v4l2:// -V image --image-out-ratio 150 --image-out-prefix $D2 --run-time 50 vlc://quit 2> /dev/video0

Posted in Bash scripting, Code, Linux, Webcam | Comments Off on Capture bash script

Webcam capture using vlc

After many attempts to use different software to take regular pictures with either an external webcam or indeed the one built into the eeepc, I found the only one I could get working was the excellent, versatile vlc.

I found this script that works well. A word of warning – MUTE YOUR SPEAKERS! Otherwise you get a horrible feedback as vlc somehow plays the microphone input back through the speakers.

cvlc v4l2:// -V image --image-out-ratio 100 --image-out-prefix Img --run-time 40 vlc://quit 2> /dev/video0

Records 3 images after 40 seconds

If you don’t specify a file format for the output (with –image-out-format jpg), it defaults to png and the quality is better.

cvlc is the console version of vlc i.e. it doesn’t open up the GUI console – equivalent to
$ vlc -I dummy… but more elegant

Posted in Code, Linux, Webcam | Comments Off on Webcam capture using vlc

Crontab

In my experiments to get my eeepc to be a recording device for the walks I was doing as part of my ‘Going Solo’ residency in Hathersage, I needed to run a script at a regular interval. The crontab is a way of doing this for a linux system. My eeepc runs Ubuntu Intrepid Ibex (8.10).

In the terminal:
crontab -e edits the crontab
crontab -l lists the crontab

this is an example of a crontab entry – runs the script every 5 minutes in the hour i.e. 13:00, 13:05, 13:10…
*/5 * * * * ~/bash_scripts/capture.sh

When you Exit, it asks you to save the file to a temporary locatoin. Don’t worry, this will update the crontab when you exit. You can check this with crontab -l in the terminal to see your changes

see Capture bash script for more about the script this crontab entry points to.

Posted in Code, Linux, Webcam | Comments Off on Crontab

First Post

I know it sounds like some kind of military roll call, but I’ve been meaning to start this blog for some time. After dipping my toe in the water here, I have come to realise that a blog is a good way of both reflecting on research and process outside of production and also trying to communicate this to others in a spirit of dialogue a la open source. Being wary of putting all this stuff on a server I don’t control, however, I’m attempting to manage this blog on our own site.

Posted in Diary | Comments Off on First Post