Is it possible to write a droplet that automatically exports a movie to a jpg image sequence (using the most recent settings)?
I found a couple of examples in the forums, but they export the movie to other formats, and my applescript knowledge is not good enough to fiddle around with the code and make it fit my needs.
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 movie as image sequence) then
try
export front movie 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
close front movie
end tell
end repeat
set AppleScript's text item delimiters to ASTID
quit application "QuickTime Player"
end open
First, let me say thank you to Bruce Phillips for this code. I have been using a bit of it to produce thumbs for quicktime movies by trimming the movie to 1 frame and then performing the image sequence export:
set thisItem to choose file
tell application "Finder"
set thumb_folder to (container of thisItem) as Unicode text
end tell
tell application "QuickTime Player 7"
open thisItem
tell document 1
select at 8000 to 8001
trim
end tell
set AppleScript's text item delimiters to {"."}
get name of (info for thisItem without size)
set exportPrefix to (text items 1 thru -2 of result) as text
export front document to (thumb_folder & exportPrefix) as image sequence using most recent settings
end tell
However, I do have one problem. When I use it to produce an image for a .m4v file, I get only a randomized image (sample here: http://www.mrmont.com/images/movieExport.jpg). The script works fine for .mov and .mp4 files.
I have tried:
Not trimming the movie at all - I get an entire sequence of such images.
Exporting as png as well as jpg - same result.
Exporting the .m4v movie from quicktime 7 manually with the most recent settings - this works fine, no randomized images.
I would greatly appreciate any light anyone could throw on this issue.
My info:
Macbook, OSX 10.6.3
Applescript Version 2.3 (118) Applescript 2.1.2
Quicktime 7 Player (Pro) 7.6.6
I used your script on an m4v file of mine and it worked fine. So I would think there’s something about the way your file is encoded that’s causing a problem. One thing you might try, since it works when you export manually, is to give the movie time to open. Maybe the movie isn’t fully open when you try to trim and export it. As such you might try a delay of a second or two after you first open the movie and again after you trim it… just as an experiment.
The other thing you might try is to use a settings file when you export rather than relying on the most recent settings. To create a settings file just start an export from q7, then stop it. Then in applescript run this script with the movie still open.
set exportFileName to "QT Export To JPG.qtSettings"
set exportFilePath to (path to desktop as text) & exportFileName
tell application "QuickTime Player 7"
tell first document
save export settings for image sequence to file exportFilePath
end tell
end tell
Now in your script change your export line to this…
set settingsFile to (path to desktop folder as text) & "QT Export To JPG.qtSettings"
export front document to (thumb_folder & exportPrefix) as image sequence using settings settingsFile
set thisItem to choose file
tell application "Finder"
set thumb_folder to (path to desktop) as Unicode text
end tell
tell application "QuickTime Player 7"
open thisItem
delay 2
tell document 1
select at 8000 to 8001
trim
end tell
delay 2
set AppleScript's text item delimiters to {"."}
get name of (info for thisItem without size)
set exportPrefix to (text items 1 thru -2 of result) as text
--export front document to (thumb_folder & exportPrefix) as image sequence using most recent settings
set settingsFile to (path to desktop folder as text) & "QT Export To JPG.qtSettings"
export front document to (thumb_folder & exportPrefix) as image sequence using settings settingsFile
end tell
Well looking at your code that’s just what I suggested. Sorry it didn’t help. As mentioned, it worked on my m4v file so you should focus your efforts on your file and what’s unusual about it. If I think of anything else I’ll let you know.
I am looking for an Applescript to export Quicktime movies to image sequences.
When I open Bruces script in the editor and run it I get this error: Expected “given”, “with”, “without”, other parameter name, etc. but found “front”.
This error refers to the line: if (can export front movie as image sequence) then
When I try to change front with given I get the error: Expected “:” but found “as”. on the same line.
up to the next error and so on.
Now I was wondering, is this script maybe not compatible with my current setup?
I am on OSX version 10.6.8, Editor version 2.3 (118), AppleScript version 2.1.2
Any suggestions appreciated!
Cheers
Model: Macbook Pro
AppleScript: 2.1.2
Operating System: Mac OS X (10.6)
OK I found why… Needed to change all tell application “QuickTime Player”
from Bruce’s script to: tell application “QuickTime Player 7”
Thanks Bruce!
Now I need to find a script example to open the sequence and create a movie from it with a different framerate.
btw. I am looking to convert movies shot at 60FPS to 30FPS thus doubling it’s timeline and creating a slow motion clip
Hey guys,
Just wanted to revive this thread as I’m having a bit of an issue exporting an image sequence from QT pro 7.
Not sure if this is a QuickTime issue, h.264 issue, or an AppleScript issue, but i thought I’d start here since I know the least about AppleScript and have some clues to the problem.
I’m creating an Automator workflow that requires a run AppleScript action. My plan is to use applescript to have QuickTime Pro 7.6.6 export an image sequence from a QuickTime movie in h.264, using a QuickTime settings file I’ve already exported. The script points to the settings file and and exports the sequence to the output folder I’ve specified. Im looking to export one frame per second. Running the script works well and I’m almost getting the result I want, except that each frame that is exported is entirely green.
Interestingly, when I run the exact same process manually, using the exact same settings, the export works fine, and the frames are correct. Additionally, exporting via AppleScript brings up a different status bar than when exporting manually, which leads me to believe that AppleScript is the culprit. Perhaps it’s running some sort of outdated process? The AppleScript status bar comes down from the top middle of the video frame, while exporting manually, brings up a floating status bar. They look decidedly different.
Has anyone run into this problem and can possibly shed some light on it? Possible AppleScript work around? This only seems to effect h.264 videos. If I run the same AppleScript on a ProRes file, the images export correctly.
Here’s the applescript I’m using…
tell application "QuickTime Player 7"
export front document to "/Users/grato/Documents/SYNC/Sync Assets/Assets/temp/Sync-" as image sequence using settings "/Users/grato/Documents/SYNC/Sync Assets/settings/Sync_QTexport_setting.qtes"
end tell