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!
Code: https://github.com/rocktronica/timelapse
How it works
- IPCamera app turns iPhone into a webcam, accessible on local network.
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.- 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
- Camcamcam: this is a wrapper I wrote around iSight and Raspberry Pi camera to take GIFs of my cat eating her food when I'm away
- Live public feeds: I'll let you find these!
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, tryls | awk 'NR%2==0' | xargs echo rm | sh
, where 2 is n.
Examples
Let's make a synth together. OKAY DIY Kits are coming soon! pic.twitter.com/GsQWnPtfb2
— Oskitone (@oskitone) September 24, 2017
Sequencer PCB assembly timelapse from oskitone on Vimeo.
Trying out some time-lapse PCB soldering pic.twitter.com/IPlRFFsaEI
— Tommy (@rocktronica) April 11, 2017
SPST_VR 0.2.2 Assembly from oskitone on Vimeo.
Making an instructional soldering timelapse gif and found this dumb meta timelapse gif I apparently made and kept pic.twitter.com/oGFjz4fIYf
— Tommy (@rocktronica) December 21, 2017
Code
Everything is on Github and MIT licensed. Enjoy!