Timelapse Script - WIP

#!/bin/bash
#
#  Uses uvccapture
 
#  The ultimate destination for the shot.
destination=/home/fathead/Downloads/beans-tl
last_file=$(ls -tr | tail -1 | cut -c 1-5)
str_last_file="$(echo $last_file | sed 's/0*//')"
new_file=`printf "%05d" $(($str_last_file+1))`
filename=${new_file}.jpg
jpg_qual=100
delay_minutes=5
delay=$(($delay_minutes*60))
#delay=($delay_minutes)
#delay=15
width=$((1920))
height=$((1080))
while true ; do
 
  uvccapture -x"$width" -y"$height" -q"$jpg_qual" -o"$filename"
 
  # Image stamp it if `convert` is installed.
 # if [ -e /usr/bin/convert ]; then
 #    convert -font helvetica -fill black -draw "text 10, 280 '`date`'" "$tempfile"  "$tempfile"
 # fi
 
  # Move it into position.
 
# /bin/mv "$tempfile" "$destination"
 
  # Pause
  sleep $(($delay));
last_file=$(ls -tr | tail -1 | cut -c 1-5)
str_last_file="$(echo $last_file | sed 's/0*//')"
new_file=`printf "%05d" $(($str_last_file+1))`
filename=${new_file}.jpg
done
 

Tags: 

Did you find this post useful? You can leave me a buck or two with the Paypal donate button, support me on Patreon, or consider buying one of the "Suggested Resources" books on the side using my affiliate code (you pay the same price for the book, but I get a small referral fee from Amazon)!

Share This Post