Skip to content

Instantly share code, notes, and snippets.

@NQNStudios
Last active August 29, 2015 14:07
Show Gist options
  • Save NQNStudios/1b6205259700fb91e36d to your computer and use it in GitHub Desktop.
Save NQNStudios/1b6205259700fb91e36d to your computer and use it in GitHub Desktop.
Contains helpful functions for using mencoder and Scrot on Linux for creating time lapses.
#!/bin/bash
# First argument: delay between time lapse screenshots (in seconds). Default=3
DELAY=${1:-"3"}
echo "Press Ctrl+C to stop capturing time lapse screenshots."
while [ 1 ]; do
scrot -q 100 "$(date +%Y%m%d%H%M%S).jpg"
sleep $DELAY
done
#!/bin/bash
FRAMES="*.jpg"
FILES="files.txt"
VIDEO="screenlapse.avi"
for FRAME in $FRAMES; do
rm "$FRAME"
done
if [ -e "$FILES" ]; then
rm "$FILES"
fi
if [ -e "$VIDEO" ]; then
rm "$VIDEO"
fi
#!/bin/bash
# First two arguments (optional): width, height of video resolution
WIDTH=${1:-"1280"}
HEIGHT=${2:-"720"}
# Third argument (optional): FPS of output video
FPS=${3:-"20"}
ls -1tr *.jpg > files.txt
mencoder -ovc x264 -oac mp3lame -mf w=${WIDTH}:h=${HEIGHT}:fps=${FPS}:type=jpg 'mf://@files.txt' -o screenlapse.avi
#!/bin/bash
FILES="files.txt"
VIDEO="screenlapse.avi"
if [ -e "$FILES" ]; then
rm "$FILES"
fi
if [ -e "$VIDEO" ]; then
rm "$VIDEO"
fi
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment