Category Archives: Webcam

Timelapse and Webcams

Images for timelapse movies can come from a variety of sources, not just your camera set up on a tripod somewhere. For example the internet is full of webcams streaming out their images 24/7 and they can make for some entertaining results. It’s also an easy way of grabbing a lot of different types and quality of images to hone your processing and production skills. The movies are obviously restricted by the refresh rate of the webcams which is not likely to be less than 10s but they can still be entertaining.

Note: The question of copyright of streaming webcam images is a complex one. According to Wikipedia and to a document written by a Swiss legal firm the question is largely untested in law and it’s likely that a webcam would fail the originality / individual character part of the copyright protection requirements. However IANAL so please take your own precautions especially if you intend using these images commercially. In any event I would strongly suggest that you contact the owner of the webcam to see if they’re happy with what you’re doing.

Thanks to the kind people at the http://www.bs.ch/ website for letting me use their webcam images to create the following example:

Accessing the Webcam Images

The technique described below will not work on all webcams. It will work on those websites that use a single URL to a webcam image that is updated each time a new image is captured. Other webcams use different libraries and I’ll discuss one of these in a future post, others still use Flash which is most definitely not in scope here. ( Flash will be gone by 2020 and, frankly, nobody will miss it )

It’s easier to describe with an example. The city of Basel in Switzerland has a couple of interesting webcams which are accessed by clicking the webcam link on the top of the page. ( Note that the slide down to display the two webcam images only works if the “DE” language is selected, I’m not quite sure why, maybe a localisation issue? )

Clicking on one of these images, e.g. the Barfüsserplatz, brings up a popup with the latest image shown in it. This image will auto-refresh every 15s as stated at the bottom of the popup. ( If the image refresh rate is not stated on a site then staring at the screen with a stop watch and clicking “refresh” every 5s is probably the best approach )

Right click on the picture and select “view image” will show the latest image in a new window. The URL is similar to:

http://zid.abel-systems.ch/webcam1/webcam.jpg?r=1502222620002

I think that the number at the end is some form of serial number, possibly with the Unix timestamp included in there somewhere. However as we don’t know how many images are stored on the server or how long they’re kept for then trimming the URL to:

http://zid.abel-systems.ch/webcam1/webcam.jpg

shows just the latest image. By clicking refresh every 15s we can see the new images as they arrive.

The city of Verona also has some similar webcams – http://webcam.comune.verona.it/index.html

Image Download Script

Gathering the images for a timelapse movie by repeatedly clicking “refresh” and right click “save image as” is entirely possible if a little tedious. It is of course much easier with a script built around the wget utility. As with all these command line tools there’s a multitude of options but we’re looking to create something like the following command for each image. The file names should of course increment sequentially to make the movie creation easier.

wget --output-document=path/to/file/file.jpg sourceURL

I’ve written a small script together with a configuration file and these can be found in my GitHUb repository – https://github.com/john-davies/Blog-code-files ( webcam_timelapse_script directory )

The script is run as follows:

./webcamfetch.sh config.cfg

There are 5 configuration values:

  • frame_count – number of frames to capture
  • frame_interval – interval between frames in seconds
  • url – location from which to fetch the image
  • store_location – directory on local disk where the downloaded images are to be stored
  • file_prefix – extra fixed text to be added on the front of the file name

The script does some brief sanity checks then just loops around the set number of times fetching and storing the images. Note that there is no error checking, if any downloads don’t work for any reason then the resulting movie is likely to be not much use anyway.

After the images have been downloaded then I follow my normal timelapse workflow. For the following example, captured from the Basel webcam, I just ran the deflickering script and created the movie as shown in the example above.

Although its quality is not HD standard it’s pretty good and there’s a lot going on in the scene:

  • the movement of the shadows and the few clouds are very obvious
  • the movement of the crane in the background and the traffic/trams would be better at a lower refresh rate
  • towards the end of the movie, as the sun hits the wall of the white building in the centre of the scene then the automatic blinds are triggered
  • towards the top left there seems to be an external lift on one of the buildings which you can just see going up and down
  • I like the timestamp at the bottom of the image, it gives a good sense of the time passing