Raspberry Pi Webcam + Timelapse

When muralist Skylar Suarez came to the neighborhood association offering to paint a tribute to medical personnel, we enthusiastically accepted—and I was tasked with finding a way of documenting the work as it happened a block or so from my office. With help from The C House, I rigged a Raspberry Pi 3a+ with a spare USB webcam I had sitting around and, using ffmpeg and motion, managed to both livestream the three days of work to the neighborhood Facebook page while simultaneously logging shots to a timelapse video. Here’s how that turned out:

Some tips:

  • The Raspberry Pi’s USB bus may not be able to maintain enough current to run devices on its own, so use a powered hub.
  • A powerful enough hub (I used a basic Amazon USB 2.0 one) can power both the Pi and the webcam; this was important because I only had access to one AC receptacle. This meant that the Pi was connected to the hub twice.
  • The version of ffmpeg that is distributed within the Raspbian system isn’t built with support for RTMPS; you’ll have to compile your own version if you want to directly stream to Facebook, which now requires RTMP over SSL. (You can still go to YouTube, which accepts plain RTMP.)
  • Use screen or tmux to ensure you can initiate the broadcast or timelapse and then be able to leave, and return if necessary to modify, restart, et cetera. You’ll need to do this if using Facebook right now, as it’s been increasingly unreliable of late. In my case, that just meant taking a notebook and getting within WiFi range of the Pi; I could have done it using a terminal emulator on my phone, too, if I’d wanted to.