Query about a script that makes webcam take an image every x seconds
I have a Trust usb webcam. I'm looking for (or creating) a script that could take a screenshot from the camera every 10 seconds and save the image to disc with a timestamp for a filename.
I've found
streamer -o 0000.jpeg -s 300x200 -j 100 -t 1 -r 10But it only runs once and it doesn't save the filename as something unique, so when the script starts again it will override the previous files with the same name.
Any ideas on a script that can start taking timelapse photos when my machine starts up?
Thanks.
3 Answers
You have a few solutions here, perhaps the best would be to run your command like this in one line:
while true; do streamer -o `date +%Y%m%d-%H%M%S`.jpg -s 300x200 -j 100 -t 1 -r 10; sleep 10; done You can use decimals in the rate. This works:
streamer -t 99999999999999 -r 0.1 -o 00000.jpegThe -t argument has to be filled for some reason but the above will run for 3 billenia (yeah). You could probably lower it down a few columns.
1You can use fswebcam :
With the webcam connected and fswebcam installed, enter the command fswebcam followed by a filename and a picture will be taken using the webcam, and saved to the filename specified:
fswebcam cam.jpgTo know more about timestamps and schedule task you can visit this site fswebcam
To see manual page visit this site Manpage
It is a great tool , i recommend it for this usage , you can also use it in a script , see the first link.
2