fsphil / fswebcam

A neat and simple webcam app
http://www.sanslogic.co.uk/fswebcam/
GNU General Public License v2.0
415 stars 86 forks source link

take a X pictures with Y seconds between every image #26

Open ladiko opened 8 years ago

ladiko commented 8 years ago

I would like fswebcam to have a 2 seconds initialization delay, then take 6 images with different names and a delay of 0.5 seconds between each image and then quit. From reading the man page, i think i can only start an infinite loop and each image gets overwriten by the next one.

Right now i am using http://linux.die.net/man/1/streamer with streamer -c /dev/video0 -q -s 1920x1080 -t 10 -r 2 -j 100 -o ~/00.ppm to create 00.ppm to 09.ppm, delete the first 4 (too dark or broken) and convert the last 6 to JPG. If i use streamer to directly create JPGs, there are strange artefacts in red colored image parts, which doesnt happen when using PPM. Maybe its related to MJPG vs. YUYV !? So streamer doesnt support an initial delay nor produce usable JPGs.

roygbyte commented 3 years ago

If you have the option to run this as a bash script, you could do this:

#!/bin/bash

INDEX=0
COUNT=3
DELAY=1
RES='1024x786'

while [[ $INDEX < $COUNT ]]; do 
    IMAGE="$INDEX".jpg
    fswebcam -r $RES $IMAGE
    echo "Image saved to $IMAGE"
    sleep $DELAY
    INDEX=$(($INDEX + 1))
done