blog.tommy.sh

Making Time-lapse Videos with an iPhone by Command Line

Here’s how I make the time-lapse videos for my Oskitone projects. It’s certainly not for everybody, but if your phone is the best camera you own and you’re not shy of the command line, maybe it could work for you!

Example setup

Code: https://github.com/rocktronica/timelapse

How it works

  1. IPCamera app turns iPhone into a webcam, accessible on local network.
  2. capture.sh script repeatedly downloads its image. (It’s basically three lines of shell but with some nice help info.) You stop this process when you’re done capturing.
  3. A followup compile.sh script uses ffmpeg to convert those images into an MP4 video for Twitter and Instagram and gifsicle for various GIF sizes.

Notes on cameras

Phone cameras

The IPCamera app starts a little server on the phone, providing a live video feed and basic camera controls with a web GUI as long as the app stays open. Inspecting its GUI from a computer’s browser, you’ll find its live video endpoint is “/live”. I emailed the author of the app and learned there’s a hidden “/photo” endpoint which returns a static JPG instead of a video stream.

While I haven’t tried other apps or other phones, they ought to be similar. As long as it can provide a JPG URL, it will work.

Other options

Other thoughts

  • Rigging
    I use a gooseneck clamping phone holder, which I bolted onto a woodworking clamp when the original cheap one broke. It's scrappy but works great.
  • Lighting, lighting, lighting
    My desk faces a large window, which makes this an easy step in non-winter months.
  • Use the right framing
    For clearer, instructional type shots, try a high eye-level angle. For moodier shots, go tight and/or to an angle.
  • Editorialize
    Unless you want the output to be accurate to time, remove unnecessary shots of blurry movement or when you’ve stepped away from the work. No one will be the wiser.
  • Removing photos
    If the delay wasn’t long enough and you want to, say, only use every other photo, you can remove them before running compile.sh. In the capture folder, try ls | awk 'NR%2==0' | xargs echo rm | sh, where 2 is n.

Examples

Sequencer PCB assembly timelapse from oskitone on Vimeo.

SPST_VR 0.2.2 Assembly from oskitone on Vimeo.

Code

Everything is on Github and MIT licensed. Enjoy!

https://github.com/rocktronica/timelapse