Skip to content

Instantly share code, notes, and snippets.

@74togo
Created May 19, 2015 23:25
Show Gist options
  • Save 74togo/7450485a90575148672d to your computer and use it in GitHub Desktop.
Save 74togo/7450485a90575148672d to your computer and use it in GitHub Desktop.
timelapse recorder
#!/bin/bash
a=1
compile_video()
{
trap exit SIGINT
# modify these as needed
FPS=15
OUTPUT=timelapse.mp4
RESOLUTION=`xrandr | grep '*' | awk '{print $1}'`
ffmpeg -framerate $FPS -i frame%06d.png -s:v $RESOLUTION -c:v libx264 -profile:v high -crf 20 -pix_fmt yuv420p $OUTPUT
rm ./frame*.png
exit
}
trap compile_video SIGINT
echo "Now recording. Control-C to stop and make video."
# change FREQ to number of seconds between screenshot
FREQ=5
while true; do
scrot `printf "frame%06d.png" $a`;
sleep $FREQ;
let "a+=1"
done
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment