Skip to content

Instantly share code, notes, and snippets.

@prafulfillment
Last active November 8, 2016 23:36
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save prafulfillment/5d02ab64d5b907786aea to your computer and use it in GitHub Desktop.
Save prafulfillment/5d02ab64d5b907786aea to your computer and use it in GitHub Desktop.
set filePath to (path to desktop as text) & "screencast.mov"
tell application "QuickTime Player"
activate
set tdoc to new screen recording --> document "Screen Recording"
delay 1
tell application "System Events" to key code 49
delay 2
repeat while exists tdoc
delay 1
end repeat
-- the recording is stopped
open for access file filePath
close access file filePath
export (first document) in filePath using settings preset "1080p"
delay 10
close (first document) without saving
quit
end tell
set user to do shell script "/bin/bash -c '/usr/local/bin/ffmpeg -i ~/Desktop/screencast.mov -pix_fmt rgb24 -r 10 -y -f gif ~/Desktop/screencast-`date +\"%Y-%m-%d_%H:%M\"`.gif'"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment