Created
May 19, 2015 23:25
-
-
Save 74togo/7450485a90575148672d to your computer and use it in GitHub Desktop.
timelapse recorder
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/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