Built a python script to automatically remove dead space from my construction timelapse
I set up a camera to capture a timelapse of a deck being built. It was configured to take photos at a set cadence between 8 AM and 5 PM, Monday through Friday throughout the project.
The problem: the raw footage had a ton of dead space. The contractors would show up in the morning, work for a few hours, leave for lunch, come back later, or spend time working on something completely outside the frame. So the resulting timelapse was mostly just... nothing happening.
I started by editing manually — scrubbing through hundreds of frames, cutting out the dead parts, stitching it back together. It was painfully tedious and not something I wanted to repeat for every day of the project. I've also seen a lot of timelapses where people deal with dead space by just cranking up the playback speed, but then the interesting parts fly by too fast and you can't actually appreciate the work being done.
So I wrote a script that analyzes the frames, detects which ones have meaningful activity, and automatically cuts out the dead space. No manual editing needed — I just point it at a folder of images and it spits out a cleaned-up timelapse. The goal is to keep the pacing consistent so you can actually watch the construction happen without fast-forwarding through hours of an empty frame.
Attached is a video showing the before and after of running it through the script.
For anyone curious about the camera setup: Raspberry Pi Zero 2W with a Raspberry Pi Camera HQ and an Arducam 2.8-12mm varifocal C-mount lens.