Raudkembingur

The red whale from nightmares.

[archives] | [latest] | [hellfish] | [atom/rss]

Time lapse
Thu 30 November 2017

A month ago I finally got around to purchasing a raspberry pi. I've been playing with it for a while, and have been using it to make time-lapse videos. Using the compatible camera module (the no-IR version), I've made a timelapse video of some of my avocado plants. The automation of this process is still a work in progress, and the snippets here are mostly for reference purposes.

TODO:

  • time/datestamp the images (-exif option?)
  • archive daily/compress images
  • video formats?
  • skip black images
webcam.sh:
#!/bin/bash

DATE=$(date +"%Y-%m-%d_%H%M")

fswebcam -r 640x480 -S 20 /home/fish/webcam/current-1.jpg &&
raspistill -w 1024 -h 768 -o /home/fish/webcam/current-2.jpg &&
cp /home/fish/webcam/current-1.jpg /home/fish/webcam/cam1/cam1-$DATE.jpg&&
cp /home/fish/webcam/current-2.jpg /home/fish/webcam/cam2/cam2-1024-$DATE.jpg

fswebcam: capture image from a V4L1/V4L2 compatible device
-r: resolution -S: number of shots to discard (give the camera time to auto-adjust)

raspistill: capture image from the raspberry pi built-in camera port
-w: width -h: height -o: output file

make_webcam_movie.sh:
ffmpeg -framerate 10 -pattern_type glob -i '/home/fish/webcam/movie/*.jpg' -c:v libx264 -r 30 -pix_fmt yuv420p /home/fish/webcam/webcam.mp4 
crontab:
* * * * * /home/fish/bin/webcam.sh 2>&1

repeat every minute

Multi-day timelapse of avocado plants growing towards the light. (The weird colors are due to the lens lacking an IR filter, which is better for low-light conditions)