Skip to content

Instantly share code, notes, and snippets.

@keyan
Forked from jamak/timelapse.zsh
Last active August 29, 2015 14:15
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save keyan/86b84f0aee064d14800b to your computer and use it in GitHub Desktop.
Save keyan/86b84f0aee064d14800b to your computer and use it in GitHub Desktop.
#! /bin/zsh
TIME=$1
FNAME=$2
# if [[ $# != 3]] then;
# echo "USAGE: $0 time_interval filename"
# exit 2
# fi
if [[ -f $FNAME ]]; then
echo "filename taken!"
exit 2
fi
a=0
while true
do
sleep $TIME
screencapture "$(pwd)/img${(l:6::0:)a}.png"
((a++))
trap "ffmpeg -framerate 30 -i img%06d.png -c:v libx264 -r 30 -pix_fmt yuv420p $FNAME.mp4;break" 2
done
exit 0
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment