Time-lapse animations have always fascinated me. With a time-lapse
you can make things visible to the human eye that are normally
happening too slow. The movement of stars
in the sky or the
process of putting up a house are very interesting to look
at when the clock has been accelerated.
Apart form creating time-lapse animations using my own pictures
I also found it worthwhile to create them from web-cam images.
A webcam near the place I live provides images of quite high resolution.
With the little script below, I was able to create this video:
Fog
over Dornbirn
I found that for videos that include clouds it is ok to take
a frame every 5 seconds or so. As I don't have the time and patience
to save the webcam images manually, I created this bash script:
1 # !/bin/bash 2 3 while[ true ];do 4 # create a filename with date and time portion 5 filename=$(date-u +"%Y%m%d_%H_%M_%S").jpg
6 # use wget to download the current image from the webcam 7 wget http://xxx.yyy/record/current.jpg -O $filename 8 # wait 5 seconds 9 sleep5;10 done;
Of course you have to replace the url with a meaningful one.
To be able to use the power of bash on my windows machine, I
installed cygwin,
which creates a linux-like environment, with the ability to use
many of the linux command line tools. To be able to use wget you
have to manually install it by selecting it from the available
packages during the install process.
To create the final movie, I import the images in to picasa,
sort the folder by name to make sure they are in the right order,
select all of them and click the "Movie" button. Select
"time-lapse" for the transition and you are ready to
create the video.
Since the start of the eruption of the Eyjafjallajökull
volcano, I assembled quite a few time-lapse animations using the
vodafone webcam. Some videos were created like the one above,
by downloading the current image every few seconds.
Downloading the vodafone
webcam archive
But the vodafone webcam has an archive of images for every minute
of a given day, that means, you can create such time-lapse animations
after the fact, you just have to harvest the folders and download
the individual images one-by-one.
As a complication, the images are actually two images stored
side-by-side:
To be able to use the image in Picasa you first have to cut in
two halves. At first I did that using batch conversion in IrfanView,
but in the end I came up with a script that does also the slicing
of the image. To be able to do that I had to install ImageMagick
in cygwin by selecting it in the cygwin setup.
There was a problem with the installation of ImageMagick, see
the instructions below on how to resolve the issue.
This is the bash script that downloads all the images for a given
day from the vodafone server. You must provide a day, and you
can provide a month and a year, if no month and year are given
they are determined based on the current date. The script writes
the downloaded images in a folder which is named for the current
date. In this folder two sub-folders are created which contain
the left and right part of the image, already cropped to the 16:9
aspect ratio necessary for creating HD videos in youtube.
1 # !/bin/bash 2 # 3 # if no day is provided print out usage 4 if[ -z "$1"];then 5 echo"usage: $0 day [month] [year]" 6 exit 7 else 8 d=$1 9 fi10 # if no parameter is provided for the month, use the current month11 if[ -z "$2"];then12 m=$(date-u +"%m")13 else14 m=`(printf "%02i" $2)`15 fi16 # if no parameter is provided for the year, use the current year17 if[ -z "$3"];then18 y=$(date-u +"%Y")19 else20 y=$321 fi22 23 # assemble the directory name24 dirname=${y}${m}${d}25 # create sub-directories for the cropped versions of the image26 mkdir -p ${dirname}/right/27 mkdir -p ${dirname}/left/28 # loop through the hours of the day29 for j in{0..23}30 do31 # prepend a leading zero to the hour32 hour=`(printf "%02i" $j)`33 # loop through the minutes of the hour34 for i in{0..59}35 do36 # prepend a leading zero to the minute37 minute=`printf "%02i" $i`38 # assemble the filename39 filename=${y}${m}${d}${hour}${minute}40 # use wget do download the image41 wget http://extras.vodafone.is/trailers/fimmvorduhals/mx10-4-235-80/${y}/${m}/${d}/$hour/$minute.jpg -O ${dirname}/${filename}.jpg
42 # crop the right-hand side of the image in 16:9 aspect ratio43 convert -crop 1024x576+1025+0${dirname}/${filename}.jpg ${dirname}/right/right_${filename}.jpg
44 # crop the left-hand side of the image in 16:9 aspect ratio45 convert -crop 1024x576+0+0${dirname}/${filename}.jpg ${dirname}/left/left_${filename}.jpg
46 done47 done48
To install ImageMagick in Cygwin search for the Word ImageMagick
in the select packages view and clck on the package to include
it in the install.
But when I tried to run a convert command, I got the following
error:
$ convert
/usr/bin/convert.exe: error while loading shared libraries: ?: cannot open shared object file: No such file or directory
After some searching on the web, I found out that some libraries
were probably missing, luckily there is a way to check for missing
dlls using the command cygcheck:
$ cygcheck convert
Found: C:\cygwin\bin\convert.exe
Found: C:\cygwin\bin\convert.exe
Found: C:\WINDOWS\system32\convert.exe
C:\cygwin\bin\convert.exe
C:\cygwin\bin\cygwin1.dll
C:\WINDOWS\system32\ADVAPI32.DLL
C:\WINDOWS\system32\KERNEL32.dll
C:\WINDOWS\system32\ntdll.dll
C:\WINDOWS\system32\RPCRT4.dll
C:\WINDOWS\system32\Secur32.dll
C:\cygwin\bin\cyggcc_s-1.dll
C:\cygwin\bin\cygMagickCore-1.dll
cygcheck: track_down: could not find cyggomp-1.dll
C:\cygwin\bin\cygX11-6.dll
C:\cygwin\bin\cygxcb-1.dll
C:\cygwin\bin\cygXau-6.dll
C:\cygwin\bin\cygXdmcp-6.dll
C:\cygwin\bin\cygXext-6.dll
C:\cygwin\bin\cygbz2-1.dll
C:\cygwin\bin\cygfontconfig-1.dll
C:\cygwin\bin\cygexpat-1.dll
C:\cygwin\bin\cygfreetype-6.dll
C:\cygwin\bin\cygz.dll
C:\cygwin\bin\cygiconv-2.dll
cygcheck: track_down: could not find cygltdl-7.dll
cygcheck: track_down: could not find cygtiff-5.dll
C:\WINDOWS\system32\GDI32.dll
C:\WINDOWS\system32\USER32.dll
C:\cygwin\bin\cygMagickWand-1.dll
To fix the issue I had to run the cygwin setup.exe again and
install the following libraries: