Skip to content

Instantly share code, notes, and snippets.

@maxchuquimia
Created October 4, 2014 07:12
Show Gist options
  • Save maxchuquimia/a9b36f6d4317ab4cacf9 to your computer and use it in GitHub Desktop.
Save maxchuquimia/a9b36f6d4317ab4cacf9 to your computer and use it in GitHub Desktop.
A script that literally uses QuickTime to convert videos
-- commandline `avconvert` didn't want to work and I was desperate, so I wrote this.
-- Use it at your own risk
-- Do what you want with it
tell application "Finder" to set chosenFiles to every file of (choose folder)
repeat with aFile in chosenFiles
-- Change to suit your extension
if name of aFile ends with ".MPG" then
-- Only do this to MPG files
tell application "QuickTime Player"
open aFile
activate
end tell
tell application "System Events" to tell process "QuickTime Player"
set frontmost to true
delay 0.7
-- Export using 720p
click menu item 2 of menu 1 of menu item "Export" of menu 1 of menu bar item "File" of menu bar 1
delay 0.7
-- Save with default location
click button "Save" of sheet 1 of window 1
delay 0.7
-- Go back to the video window (cos the export progress will open)
keystroke "`" using command down
delay 0.7
-- Close the video window
keystroke "w" using command down
-- You should change this delay to be about the average time you expect a video to take :)
delay 27.0
end tell
end if
end repeat
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment