FRIHOST FORUMS SEARCH FAQ TOS BLOGS COMPETITIONS
You are invited to Log in or Register a free Frihost Account!


How to grab webcam images in sequence automatically





outofnicks
Here is a very useful terminal script for Linux and OSX users, which saves a successive series of webcam images when the URL of that webcam stays the same, as is usually the case. It uses the terminal program "curl" to grab the images, names each one using the exact date and time, and puts them in a folder of your choice.

Code:
#!/bin/bash
while true
do
echo "\%H%M%S  Fetching image..."
cd /home/kenn/Documents/Webcams/lakecam
FILENAME=`date +"%m%d%y-%H%M%S"`
curl -o $FILENAME.jpg http://www.galesofnovember.org/webcam.jpg
sleep 20
done &


Copy and paste the above into a plain text file and name it what you want, with an "sh" extension.
I have a set of scripts for different webcams I like, in my home folder, in a "bin" directory. Make the script file executable with permissions of 755. You can do that in the Properties dialog of Linux, for example, Ubuntu which is what I use.

The first line is the shebang, you might need something different depending on what terminal shell you are using.
If you go open the script where the images will be kept with your terminal, you don't need the line starting with "cd" but with that line you can just type the name of your script and not have to bother changing directories.

Set the number of seconds that the webcam updates, and/or the period of seconds you want a new image grabbed, in the line starting with "sleep".

The files are named as so in this script, in the line starting with "FILENAME=" :
122908-181521.jpg
The date first, then the time.

I have had this running for days at a time sometimes, just so I can grab interesting sequences of ships going through a canal in my home town. I select what I want, make a little slideshow, and trash the rest usually so I don't fill up my hard drive.

Hope this is useful to someone!
jackill
Also for Windows there's a lot of software to do this: Capture Me, Fwink, etc... Also it provide automatic ftp upload, so You can store images on www server, to use it as "wabcam on page", without streaming. Useful for low-bandwidth connections.
Related topics
Arles Image Web Page Creator, creating the best images site
Thumbnails W/O extra file
Getty Images
Bulent's Screen Recorder v.2.4b
XP automatically assigned the new drive letter sequence?
iSpy 1.1.4.3
Visual Basic Tutorial - Control Arrays: What, Why and How
Uplaoding images using php form :::: Help needed
Webcam
Lost Gems - Games you think sliped under the radar.
Rollover Buttons or Images
FREE Powerfull Software for Windows
My hiking/survival gear, explained. (Warning, ~90 pics)
SEO your Joomla website
Reply to topic    Frihost Forum Index -> Computers -> Software

FRIHOST HOME | FAQ | TOS | ABOUT US | CONTACT US | SITE MAP
© 2005-2011 Frihost, forums powered by phpBB.