2018-06-11

Optimizing Raspberry Pi time-lapse workflow

After having made 11+ time-lapse videos continuously by running over 70k JPEG files from the Raspberry Pi through several hardware and software, i did some further optimization. I removed the batch editing step, and let FFmpeg crop and scale all at once. This way i'm saving almost an hour of processing time, and a lot of energy too. But it was a good exercise in adding pieces to the chain.
After all, ImageMagick can do a lot more than only cutting photos to the right size. For example, select parts to be blurred for privacy reasons, or create animated GIF images for low-bandwidth users. And if i ever need some of the features, i can easily incorporate them to meet future requirements. Remotely related, so far, i have produced over 10.000 videos in my life, and since May 2008, i distributed them across multiple YouTube channels, combined with more than 12 million views.
Having the Pi running for a week results in a video length of around 6 minutes. The encoding takes close to 14 minutes and ends with a size of up to 500 MB. Since i let the headless Zero W run without any breaks, except at midnight for creating the zip file, the flow of clouds and stars feels much smoother now. To get this to work, without to crash the Raspberry Pi too often, i made FreshRSS only check for new updates every two hours, limited from 6 am to 10 pm. Because at night, the camera job requires a bigger portion of the very few resources of the Zero W, since the "exposure time" is set to be longer, and the ISO is higher. And to reduce noise, i adjusted the compression rate, which makes the file sizes larger too.