Planes, Training and Automated File Renaming
Recently at Picademy Birmingham, I set myself a quick challenge. To create a timelapse of the lovely airfield that our training centre overlooked.
So I setup a Raspberry Pi Zero W to take a photograph every 1 minute for three hours.
I made a quick #PiZeroW based timelapse to capture the planes #picademy pic.twitter.com/ZVsEKb8mqO
— biglesp (@biglesp) April 11, 2017
All the images
These images were originally saved with the time and date they were taken...but in order to use them to create a video I needed to update their file names into a sequence, starting from 1 and ending at 185. Luckilly I found a one line bash script to convert the image file names to sequential numbers.
ls | cat -n | while read n f; do mv "$f" "$n.extension"; done
Just change extension
to match the file type. In this case jpg
Creating the video
So to create the video I used avconv
on my Ubuntu laptop to join the images.
avconv -r 10 -start_number 1 -i %d.jpg -b:v 1000k test.mp4
And that was it, the video was created and ready for upload to Youtube.
Complete Code Listing
Here is the code that was written in a BASH script.
#!/bin/bash
today=`date '+%Y_%m_%d__%H_%M_%S'`;
filename="/home/les/$today.test"
raspistill -o $filename;
print $filename;