Skip to content

Instantly share code, notes, and snippets.

@CyJimmy264
Created March 9, 2018 10:25
Show Gist options
  • Save CyJimmy264/358bc3660501c19edf254b5b3b4d7119 to your computer and use it in GitHub Desktop.
Save CyJimmy264/358bc3660501c19edf254b5b3b4d7119 to your computer and use it in GitHub Desktop.
Screenlapser with scrot and mencoder
#!/usr/bin/env zsh
write_avi() {
mencoder -ovc x264 -mf w=1400:h=900:fps=20:type=jpg \
"mf://@screenlapser-$atimeout.txt" \
-o screenlapse-`date +%Y-%m-%d-%H-%M-%S`.avi
xargs rm < screenlapser-$atimeout.txt
rm screenlapser-$atimeout.txt
}
trap 'atimeout=$timeout; write_avi; trap - INT; kill -INT $$' INT
while true; do
timeout=`date -Ins --date "+1 hour"`
while [[ $shot < $timeout ]]; do
shot=`date -Ins`
scrot -q 30 $shot.jpg
echo $shot.jpg >> screenlapser-$timeout.txt
sleep 0.333
done
atimeout=$timeout
write_avi &
done
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment