HOWTO: Time lapse with Contour HD GPS

(NOTE: This is a work in progress and mostly to remind myself of the process…)

When I started out experimenting with time lapse movies, I found there were surprisingly few ready-made open source or even commercial software packages that were simple to use, effective or even relevant for my relatively modest needs.

Of course there is QuickTime Pro and all the full blown movie editing packages, but being a geek I figured I could do better. Or at least cheaper ūüôā

Requisites

These are the main items I use in this article. if you got this far I’m sure you can generalize to whatever hardware and distro you have available.

  • A Contour HD GPS
  • A Debian box
  • Software: ImageMagick, FFmpeg in particular.

Preparation

First make sure you have the necessary software on your box:

anders@localhost:~$ sudo aptitude install ffmpeg imagemagick
anders@localhost:~$ wget ftp://ftp.armory.com/pub/scripts/ren

Shoot the stills

The Contour offers  the possibility of shooting stills with intervals of 3, 5, 10, 30 or 60 seconds (unfortunately not lesser intervals of eg. 1 second!) Choose whichever fits your application/scene.

Assemble the stills on your box

The Contour sticks images in successive folders named 100MEDIA, 101MEDIA and so forth. Each folder contains 999 JPEGs, so if you’re shooting for more than 50 minutes or so, you will have more than one folder to deal with.

The next problem then is that the photos are named FILE0001.JPG to FILE0999.JPG in each folder, causing a “namespace collision” :-/

Alas, ren to the rescue.

Assume that you have less than 10K images totally and that the files in the first directory (eg. 100MEDIA) are numbered from 0001 to 0999. Then, by issuing the following command in the second directory (eg. 101MEDIA)

anders@localhost:~$ ren -z4 '-m1=i+999' 'FILE*.JPG'

you will end up having files numbered 1000 to 1998. Voila. Repeat ad nauseam with any subsequent directories. The -z4 option zeropads to 4 digits. You may want to stick -t -v options on as well to see what happens before actually performing the rename.

(Take a timeout here to read the ren documentation – a truly powerful tool!)

After having all the photos sequentially numbered with no gaps it is time to copy/move them all into a single directory for further processing.

 Resizing

The still photos from the Contour are  2592 x 1944 which is unnecessarily large for even Full HD, and so to save processing time and memory consumption in the later stages it is wise to resize them Рfor this we use ImageMagick Рanother excellent tool which cannot be praised enough!

The less savvy photo hacker would issue commands like

anders@localhost:~$ convert FILE0001.JPG -resize 1920x1440 \
                    out/file0001.jpg

but even with a bit of scripting this is tedious and unnecessary as the ImageMagick packages also contains mogrify:

anders@localhost:~$ mogrify -path out -resize 1920x1440 FILE*.JPG

Voila – several thousand resized images in the out/ folder!

Making movies

For combining all those photos to a movie, FFmpeg is the obvious choice. Chdir into the output directory with the resized photos and issue

anders@localhost:~$ ffmpeg -i FILE%04d.JPG -r 15 \
                    -vf crop=in_w:1080:280:0 -s hd1080 \
                    -vcodec libx264 -vpre lossless_medium \
                    -crf 16 timelapse_1080.mp4

There are certain things to note here.

First of all, experiment with the framerate (-r 15). The indicated value works well for me with the timelapses I do, your mileage may vary. Also the “constant rate factor” (-crf 16) option seems well chosen for small fast-changing segments in the frames, as in time lapses.

Secondly, the preset filter (-vpre lossless_medium) can be changed to suit your needs, look in /usr/share/ffmpeg.

Finally, and more puzzling to me is the crop video filter (-vf crop=in_w:1080:280:0). My idea is to make a 1920×1080 movie from 1920×1440 photos by cropping 280px in the top and 100px in the bottom, yet I end up with a “vertical letterbox” where the active video is seemingly only 1080 wide… I’ll be working on that one… Any tips? Anyone?

Still, it is good fun and rather great results for a limited effort. You can see an example below:

This entry was posted in Photo and tagged , , , , , , . Bookmark the permalink.

One Response to HOWTO: Time lapse with Contour HD GPS

  1. vasilis says:

    Hi!
    I am using the contour-gps, lightstudio 3,its realy easy to use,you can crop and edit the files however you like.
    here are some tips for using it “https://www.youtube.com/watch?v=TM7EJZ-8HWw”
    When i like to add some music i use Hitfilm ultimate.
    results:https://www.youtube.com/watch?v=–vVXV–Z5E

Leave a Reply

Your email address will not be published. Required fields are marked *