Skip to content

Instantly share code, notes, and snippets.

@saltlakeryan
Created August 25, 2017 15:22
Show Gist options
  • Save saltlakeryan/2d74606b6616ca1865c885ee8b9fc094 to your computer and use it in GitHub Desktop.
Save saltlakeryan/2d74606b6616ca1865c885ee8b9fc094 to your computer and use it in GitHub Desktop.
Create screenshot every few seconds. At the end of day, combine into one video screencast
#!/bin/bash
SLEEPTIME=5
RUNTIME_IN_SECONDS=28800
COUNTER=0
DAYSTAMP=$(date +%Y-%m-%d)
while [ "$COUNTER" -lt "$RUNTIME_IN_SECONDS" ]
do
TIMESTAMP=$(date +%Y-%m-%d-%H-%M-%S)
echo $TIMESTAMP
scrot ~/Pictures/screenshots/$TIMESTAMP.jpg
sleep $SLEEPTIME
COUNTER=$[ $COUNTER + $SLEEPTIME ]
#quit after 6pm
if test $(date +%H) -gt 18; then echo After 6pm; fi
done
echo now running "ffmpeg -r 1 -pattern_type glob -i '$DAYSTAMP*.jpg' -c:v libx264 $DAYSTAMP.mp4"
ffmpeg -r 1 -pattern_type glob -i "$DAYSTAMP*.jpg" -c:v libx264 $DAYSTAMP.mp4
echo now running "rm $DAYSTAMP*.jpg"
rm $DAYSTAMP*.jpg
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment