Taking incremental photos and creating a time lapse video on macOS with open source

Nick DeNardis
3 min readSep 26, 2016

--

Living in Michigan requires anyone on a lake to take their boat and dock in before winter and put everything back in the spring when the lakes thaw.

My dad, brother and I have been doing this dance since I remember. Every year we talk about recording a time lapse video of process.

Limited hardware on hand

This year we thought about it too late and thus we only had our phones and a Macbook. Without any specialized hardware (video camera or tripod to hold a cell phone) I thought there must be some app in the App Store to do it.

Lots of choices…

The App Store has a lot of apps, almost all cost money, most without a number of significant reviews and none that did both incremental photos from the webcam and then stitching together into a final video file. Plus they all looked like junk.

Incremental photos with ImageSnap

After some Google searches I came across ImageSnap — Capture Images from the Command Line. An open source tool that takes single or incremental photos.

$ brew install imagesnap
$ imagesnap -h
USAGE: imagesnap [options] [filename]
Version: 0.2.5
Captures an image from a video device and saves it in a file.
If no device is specified, the system default will be used.
If no filename is specified, snapshot.jpg will be used.
Supported image types: JPEG, TIFF, PNG, GIF, BMP
-h This help message
-v Verbose mode
-l List available video devices
-t x.xx Take a picture every x.xx seconds
-q Quiet mode. Do not output any text
-w x.xx Warmup. Delay snapshot x.xx seconds after turning on camera
-d device Use named video device

Our process took roughly three hours, we decided to take a photo every 3 minutes.

$ imagesnap -t 180
Capturing image from device “FaceTime HD Camera”…
snapshot-00000–2016–09–24_10–02–01.414.jpg
snapshot-00001–2016–09–24_10–05–01.423.jpg
snapshot-00002–2016–09–24_10–08–01.432.jpg
snapshot-00003–2016–09–24_10–11–01.445.jpg
...

Combining sequential photos into a video with `tlassemble`

Linked from the ImageSnap README they recommend tlassemble —An open source Time Lapse Assembler.

But I couldn’t get it to install on Sierra with Xcode 8.

$ brew install tlassemble
fatal error: ‘QTKit/QTKit.h’ file not found

==> make
clang -mmacosx-version-min=10.6 -framework Foundation -framework AppKit -framework QTKit tlassemble.m -o tlassemble
tlassemble.m:38:9: fatal error: ‘QTKit/QTKit.h’ file not found
#import <QTKit/QTKit.h>
^
1 error generated.

Apparently I was not alone. The fix most people used was to install a previous version of Xcode, something I didn’t have the bandwidth or time to mess around with. So I downloaded the compiled version from their homepage.

$ ./tlassemble ~/Desktop/dock-photos/ ~/Desktop/time_lapse.mov -fps 5 -height 720 -codec h264 -quality high
Processed snapshot-00000–2016–09–24_10–02–01.414.jpg (1 of 54)
Processed snapshot-00001–2016–09–24_10–05–01.423.jpg (2 of 54)

Successfully created ~/Desktop/time_lapse.mov

After a number of tries, we settled on a framerate of 5, h264 codec and 1280x720 gave a sane filesize. 54 photos combined to an 11 second video at a size of 25 megs.

Success!

Prefer a GUI? “Interval” app will combine photos into video (not open source)

Although it’s not open source, “Interval is a simple to use, yet powerful time-lapse compiler. Use it to create high quality video files from your time-lapse photo sequences. Includes support for UHD video, high resolution RAW photos, key-frame pan and zoom animations and more.”

Simple interface with just the right number of options

Bonus: Create a GIF using ImageMagick

$ brew install imagemagick
$ convert -delay 25 -layers optimize -fuzz 1% -resize 30% *.jpg ~/Desktop/dock.gif

Result

--

--

Nick DeNardis

Minimalist. UX crafter. Library Scientist. Speaker. Realist. Web Director at @waynestate. @TEDxDetroit, @DetroitLaravel & @RefreshDetroit organizer.