I’m building a Quicktime player script that exports a movie as an image sequence with images captured at specified intervals, i.e., 3 seconds, 5 seconds, etc.
Regarding settings, all of the info I’ve read so far indicates you have to either use default settings or recent settings. I want to distribute this to our creative department and I don’t want them to even have a settings file. I’d like to call it on the fly like this:
export front document to (exportFolder & exportPrefix) as image sequence using settings "jpg, .25 fps"
except that doesn’t work. It should save a frame every 4 seconds but it doesn’t seem to do anything.
Here is the portion of the script that exports:
if (can export front document as image sequence) then
try
export front document to (exportFolder & exportPrefix) as image sequence using most recent settings
on error errorMsg number errorNum
display dialog "Error (" & errorNum & "):" & return & return & errorMsg buttons "OK" default button 1 with icon caution
end try
else
display dialog "QuickTime Player can't export "" & (thisFile as Unicode text) & "" as an image squence." buttons "OK" default button 1 with icon caution
end if
I would like to have the settings embedded in the AS app. Is there a way to do this so I don’t have to distribute a settings file with the app?
The entire script is posted below:
on run
choose file with prompt "Export these video files to image squences:" with multiple selections allowed without invisibles
open result
end run
on open droppedItems
tell application "QuickTime Player"
activate
close every window
end tell
set ASTID to AppleScript's text item delimiters
repeat with thisItem in droppedItems
set AppleScript's text item delimiters to {"."}
get name of (info for thisItem without size)
try
set exportPrefix to (text items 1 thru -2 of result) as text
on error
set exportPrefix to result
end try
set AppleScript's text item delimiters to {""}
tell application "Finder"
try
make new folder at (container of thisItem) with properties {name:(exportPrefix & " Image Squence")}
set exportFolder to result as Unicode text
on error errorMsg number errorNum
display dialog "Error (" & errorNum & "):" & return & return & errorMsg buttons "Cancel" default button 1 with icon caution
end try
end tell
tell application "QuickTime Player"
open thisItem
if (can export front document as image sequence) then
try
export front document to (exportFolder & exportPrefix) as image sequence using settings "jpg, .25 fps" --most recent settings
on error errorMsg number errorNum
display dialog "Error (" & errorNum & "):" & return & return & errorMsg buttons "OK" default button 1 with icon caution
end try
else
display dialog "QuickTime Player can't export "" & (thisFile as Unicode text) & "" as an image squence." buttons "OK" default button 1 with icon caution
end if
close front document
end tell
end repeat
set AppleScript's text item delimiters to ASTID
quit application "QuickTime Player"
end open