Quicktime 7.1.3 scripted export to MP4 using settings file

I know there are loads of topics asking how to export from Quicktime Pro. But this one is slightly different in that I had a working script then Quicktime 7.1.3 broke it and now I’m getting ultra-wierdness while trying to work around it. As I’m new to Applescript (Though I have long year in other scripting languages) I though I’d ask you guys:

  1. I wrote a script that would export everything in a given directory (QT wrapped DV) to raw dv/mov using presets/m4v using “as iTunes”
  2. 7.1.3 came out and changed the “as iTunes” to a higher res which made out M4V’s unacceptable large and illustrated that we needed to deinterlace at that resolution. None of this was possible with the “as iTunes” export option so.
  3. I changed the export to “as MPEG4 using settings…” did a full export manually then ran:

with timeout of 86400 seconds
tell application "Quicktime Player"
save export settings movie 1 for Quicktime movie to choose file name
end tell
end timeout

To export the settings

Then I chopped of a small amount of source footage to test out the script (56 sec of PAL DV @ 202MB).
The resultant mp4 file would not play in Quicktime and was 395.5MB in size.
Now if I fired up Quicktime and did the export manually I got a valid mp4 of under 5 meg that would sync with an iPod fine.
My script did nothing of the sort. Each time I re-exported the settings just in case

Here’s my cut down version of my export script


set vidlist to (list folder ((vidfolder & input) as alias) without invisibles)
with timeout of 86400 seconds
try
tell application "Quicktime Player"
activate
close every window
repeat with vidfile in vidlist
set currentfile to vidfolder & input & ":" & vidfile
open file currentfile
if not (exists movie 1) then error "No movies are open."
stop every movie
set the movie_name to the name of movie 1
set movie_name to movie_name & ".mp4"
if (can export movie 1 as MPEG4) is true then
set the new_file to vidfolder & output & ":" & movie_name
export movie 1 to new_file as MPEG4 using settings vidfolder & ":qtsettings_16_9_mp4_4" replacing yes
else
error "This movie cannot be exported as a XXXXX."
end if
close movie 1
end repeat
end tell
on error error_message number error_number
if the error_number is not -128 then
beep
display dialog error_message buttons {"Give Up"} default button 1
end if
end try
end timeout

Now I’ve been messing with this for a while and wondering what goes into these settings files. So I tried changing:

export movie 1 to new_file as MPEG4 using settings vidfolder & ":qtsettings_16_9_mp4_4" replacing yes

to

export movie 1 to new_file as iTunes using settings vidfolder & ":qtsettings_16_9_mp4_4" replacing yes

What I got was an enormous m4v (looking at the file in a hex editor confirmed that it was an m4v wrapper even though my script names the file mp4 right now) that would play and Quicktime reported that it was an m4v container using the DVCPRO50 codec! something that you can’t actually do from the Quicktime UI.

I’m guessing that it was doing the same thing with the previous mp4 container (even though the mp4 and mv4 containers are supposed to be virtually identical) but DVCPRO50 in m4v is allowed whereas DVCPRO50 in mp4 is not.

Arrrrgh, I’ve just realised what I was doing wrong now that I’ve written it out. I’ll still post this anyway on the of chance it helps some other poor unfortunate in a similar position to mine

save export settings movie 1 for Quicktime movie to choose file name

should have been

save export settings movie 1 for MPEG4 to choose file name

If I wanted to export the setting for the MPEG4 export…
But that is interesting. That you can apply one profiles setting to another profile, I wonder if that means you can save MP4 settings and get use

export movie 1 to new_file as iTunes using settings vidfolder & ":qtsettings_16_9_mp4_4" replacing yes

to alter the preset in a way you can’t do in the Quicktime UI.

Sorry to bother y’all

Model: Intel Mac Mini Duo
Browser: Firefox 1.5.0.7
Operating System: Mac OS X (10.4)