Monday, April 22, 2019

#1 2006-02-12 07:19:37 am

Trash Man
Sanitation Department
Registered: 2005-10-20
Posts: 5336

Export QuickTime movie to image sequence

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.

Any help would be much appreciated.


One mans trash is another mans treasure

Offline

 

#2 2006-02-12 11:47:27 am

Bruce Phillips
Administrator
Registered: 2004-07-16
Posts: 2649

Re: Export QuickTime movie to image sequence

Try saving this as an application:

Applescript:

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


Filed under: QuickTime, Finder

Offline

 

#3 2010-07-15 07:31:48 pm

mrmont
Member
Registered: 2008-02-01
Posts: 12

Re: Export QuickTime movie to image sequence

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:

Applescript:

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:
1. Not trimming the movie at all - I get an entire sequence of such images.
2. Exporting as png as well as jpg - same result.
3. 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

Last edited by mrmont (2010-07-15 07:33:29 pm)

Offline

 

#4 2010-07-16 02:46:37 am

regulus6633
Member
From:: Taulov, Denmark
Registered: 2006-11-02
Posts: 1695
Website

Re: Export QuickTime movie to image sequence

mrmont wrote:

When I use it to produce an image for a .m4v file, I get only a randomized image


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.

Applescript:

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...

Applescript:

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

Maybe it will help.

Offline

 

#5 2010-07-16 06:08:51 am

mrmont
Member
Registered: 2008-02-01
Posts: 12

Re: Export QuickTime movie to image sequence

Thanks for the rapid reply.  Unfortunately, I got the same result with the m4v files. 

Here are the contents of the export settings file:

sean,timefps ftypJPEGïvidedntr"sptljpegexiftife thum" "?

and here is the altered script:

Applescript:

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

Last edited by mrmont (2010-07-16 06:15:22 am)

Offline

 

#6 2010-07-16 06:22:52 am

regulus6633
Member
From:: Taulov, Denmark
Registered: 2006-11-02
Posts: 1695
Website

Re: Export QuickTime movie to image sequence

mrmont wrote:

Thanks for the rapid reply.  Unfortunately, I got the same result with the m4v files.


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.

Offline

 

#7 2010-07-16 06:32:33 am

mrmont
Member
Registered: 2008-02-01
Posts: 12

Re: Export QuickTime movie to image sequence

Thanks, I appreciate that. 

To make sure there's nothing funny about my m4v files, I've tried files that came from iMovie, eyeTV, and quicktime itself.  Same result. 

I wonder if there's something strange going on between the newer version of applescript and the older version of quicktime that I have...?

Offline

 

#8 2010-07-16 06:39:58 am

regulus6633
Member
From:: Taulov, Denmark
Registered: 2006-11-02
Posts: 1695
Website

Re: Export QuickTime movie to image sequence

I'm using the same version of applescript and quicktime 7, although I'm on 10.6.4.

Offline

 

#9 2011-12-22 01:31:55 am

antonputtemans
Member
Registered: 2011-12-21
Posts: 2

Re: Export QuickTime movie to image sequence

Hello,

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)

Last edited by antonputtemans (2011-12-22 01:33:07 am)

Offline

 

#10 2011-12-22 01:55:14 am

antonputtemans
Member
Registered: 2011-12-21
Posts: 2

Re: Export QuickTime movie to image sequence

OK I found why... Needed to change all
tell application "QuickTime Player"
from Bruce's script to:
tell application "QuickTime Player 7"

smile

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

Offline

 

#11 2013-02-27 07:10:57 pm

miabifilms
Member
Registered: 2013-02-06
Posts: 7

Re: Export QuickTime movie to image sequence

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...

Applescript:

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
   

here's a picture of the different export bars...
https://www.dropbox.com/s/x77liwyck5jyh … ars_qt.jpg

Last edited by miabifilms (2013-02-27 07:14:15 pm)

Offline

 

#12 2013-03-01 08:37:17 am

miabifilms
Member
Registered: 2013-02-06
Posts: 7

Re: Export QuickTime movie to image sequence

I forgot to mention...

in the picture:
http://www.dropbox.com/s/x77liwyck5jyh4 … ars_qt.jpg

the export bar at the top appears when running the applescript.  This produces all green images.

the floating export bar at the bottom appears when you manually export the image sequence.  This produces the correct result.

I'm baffled.

Last edited by miabifilms (2013-03-01 08:38:18 am)

Offline

 

Board footer

Powered by FluxBB

RSS (new topics) RSS (active topics)