Last active
June 16, 2023 21:31
-
-
Save jcayzac/142da3cfa9b00a1d9af2f29260d45930 to your computer and use it in GitHub Desktop.
Timelapse screen capture for macOS
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
# Start a 1fps screen capture to `~/Movies/timelapse - <end-datetime>.webm`. | |
# Requires ffmpeg+libvpx installed: `brew install ffmpeg`. | |
# Press `q` to stop. | |
capture_timelapse() { | |
local output="$HOME/Movies/timelapse - $(date '+%y-%m-%d %H%M%S').webm" | |
local device=$(set +e +o pipefail; ffmpeg -f avfoundation -list_devices true -i '' 2>&1 | sed -En 's#^.*\[([a0-9]+)\] Capture screen 0#\1#p'; true) | |
if [ -n "$device" ] | |
then | |
printf 'Capturing timelapse to "%s"…\nPress Q to stop.\n' "$output" | |
ffmpeg \ | |
-hide_banner \ | |
-loglevel panic \ | |
-f avfoundation \ | |
-i "$device:none" \ | |
-r 30 \ | |
-filter:v "setpts=PTS/30" \ | |
"$output" | |
fi | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment