Skip to content

Instantly share code, notes, and snippets.

@mbainrot
Last active August 29, 2015 14:22
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save mbainrot/492e6cea5c42bc5835e2 to your computer and use it in GitHub Desktop.
Save mbainrot/492e6cea5c42bc5835e2 to your computer and use it in GitHub Desktop.
Timelapse Script
# Edit this file to introduce tasks to be run by cron.
#
# Each task to run has to be defined through a single line
# indicating with different fields when the task will be run
# and what command to run for the task
#
# To define the time you can provide concrete values for
# minute (m), hour (h), day of month (dom), month (mon),
# and day of week (dow) or use '*' in these fields (for 'any').#
# Notice that tasks will be started based on the cron's system
# daemon's notion of time and timezones.
#
# Output of the crontab jobs (including errors) is sent through
# email to the user the crontab file belongs to (unless redirected).
#
# For example, you can run a backup of all your user accounts
# at 5 a.m every week with:
# 0 5 * * 1 tar -zcf /var/backups/home.tgz /home/
#
# For more information see the manual pages of crontab(5) and cron(8)
#
# m h dom mon dow command
25 20 * * * /root/start_timelapse.sh
#!/bin/sh
# Time-lapse capture script
# Max Bainrot 12-06-2015
# CONFIGURATION
FRAME_DELAY=5.0 # Delay each frame by 5 seconds
FRAME_COUNT=8640
OUTPUT_FOLDER="/tmp/timelapse"
FILENAME_DATE=`date +"%d-%m-%Y"`
ARCHIVE_OUT="/root/$FILENAME_DATE.tar.gz"
TITLE="Maxicam 1.0"
SUBTITLE="**Meow** =^.^="
INFO="AUTHOR: Max Bainrot"
# END OF USER SERVICABLE CODE
i=0
echo "CAPTURING... [CTRL+C] to cancel..."
while [ $i -lt $FRAME_COUNT ]
do
ts=`date +%s`
nextts=$(($ts+5))
fswebcam -r 1280x720 -S 15 --jpeg 99 -p MJPEG --shadow --title "$TITLE" \
--subtitle "$SUBTITLE" --info "$INFO" \
--save "$OUTPUT_FOLDER/$ts.jpg"
while [ $ts -lt $nextts ]
do
ts=`date +%s`
sleep 0.05
done
i=$(($i+1))
done
tar -czzf "$ARCHIVE_OUT" "$OUTPUT_FOLDER/"
#!/bin/bash
screen -dmS timelapse /bin/sh /root/dotimelapse.sh
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment