Skip to content

Instantly share code, notes, and snippets.

@tothebeat tothebeat/Makefile
Last active Nov 28, 2018

Embed
What would you like to do?
Periodic Screenshots (every 10 seconds) on Mac OS X

How to browse that easily like playing a video? I guess it's not really necessary to make a movie, I can just browse by file. If I wanted to create a super-fast movie where every screencap was a frame, I could install ffmpeg and ImageMagick and use the convert utility:

brew install imagemagick
brew install ffmpeg
convert 2015-04-13/*.jpg 2015-04-13-timelapse.mpeg
help:
@echo "Please use \`make <target>' where <target> is one of"
@echo " screencap To start recording screencaps and clean up yesterday's captures."
@echo " cleanyesterday Just delete yesterday's captures."
@echo " captoday Just start recording screencaps for today."
screencap:
./remove_yesterday_recording.sh
./start_recording.sh
cleanyesterday:
./remove_yesterday_recording.sh
captoday:
./start_recording.sh
#!/bin/bash
yesterday_folder=$(date -r $((`date +%s` - 86400)) '+%Y-%m-%d')
if [ -d $yesterday_folder ]; then
echo "Deleting screencaps from yesterday's folder $yesterday_folder"
rm -rf ./$yesterday_folder
else
echo "Yesterday's folder doesn't exist, nothing to remove."
fi
#!/bin/bash
today_folder=$(date +%Y-%m-%d)
if [ ! -d $today_folder ]; then
echo "Today's folder does not exist, creating $today_folder"
mkdir -p $today_folder
else
echo "Today's folder already exists."
fi
while [ 1 ]; do
screencap_name=$(date +%Y-%m-%d-%H-%M-%S)
screencapture -t jpg -x $today_folder/$screencap_name.jpg
sleep 10
done
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.