Re: Export Quicktime Pro to multiple mp4 formats
Re: Export Quicktime Pro to multiple mp4 formats
- Subject: Re: Export Quicktime Pro to multiple mp4 formats
- From: "email@hidden" <email@hidden>
- Date: Mon, 5 Jul 2010 13:40:14 -0700
Here's a new version to try.
This version runs the "can export as" command before attempting the export.
HTH
ES
---------
tell application "QuickTime Player 7"
set AVIsettings to {AVI, "2x CD-Rom", "avi"}
set MPEG4settings to {MPEG4, "Broadband - High", "MP4"}
end tell
set formatList to {AVIsettings, MPEG4settings}
set userDesktop to path to desktop as text
tell application "Finder"
try
set outputFolder to userDesktop & "Output" as alias
on error
set outputFolder to (make new folder at userDesktop with properties {name:"Output"}) as alias
end try
set inputFolder to (userDesktop & "input") as alias
set moviesToConvert to files of inputFolder as alias list
end tell
repeat with thisMovie in moviesToConvert
tell application "Finder"
set oldExt to name extension of thisMovie
set originalName to name of thisMovie
set AppleScript's text item delimiters to {"." & oldExt}
set filePathRoot to text items 1 thru -2 of (thisMovie as text) as text
end tell
tell application "QuickTime Player 7"
activate
open thisMovie
repeat with myFormat in formatList
set {movFormat, movPreset, movExtension} to myFormat
set outputFile to filePathRoot & "-lo." & movExtension
if front document can export as movFormat then
with timeout of 600 seconds
export front document to outputFile as movFormat using settings preset movPreset with replacing
end timeout
else
tell me
activate
display alert originalName & " cannot export as " & movFormat as text giving up after 20
end tell
activate
end if
end repeat
close front document
end tell
end repeat
------------
On Jul 4, 2010, at 9:44pm, John Muchow wrote:
> Thanks very much!. I was able to run the script as you wrote it and I
> clearly must have something wrong with my install of Quicktime as I
> still get an unwatchable movie when I play the exported file - it
> appears are colored noise, no discernible content.
>
> I have no idea how to track this one down...maybe a reinstall of QuickTime ?
>
> On Sun, Jul 4, 2010 at 9:48 PM, email@hidden <email@hidden> wrote:
>>
>> On Jul 4, 2010, at 2:35pm, John Muchow wrote:
>>
>>> Can anyone successfully use the script to convert a file?
>>
>> This works for me. To get the combination of format, setting and extension you need for each export you need to look in the dictionary and the UI export dialog. These two examples should be enough to get you started.
>> ---------------
>> tell application "QuickTime Player 7"
>> set AVIsettings to {AVI, "2x CD-Rom", "avi"}
>> set MPEG4settings to {MPEG4, "Broadband - High", "MP4"}
>> end tell
>>
>>
>> set formatList to {AVIsettings, MPEG4settings}
>> tell application "Finder"
>> set the startup_disk to the name of the startup disk
>> end tell
>> set User to do shell script "whoami"
>> set input_folder_name to "Input"
>> set input_folder to startup_disk & ":Users:" & User & ":Desktop:" & input_folder_name & ":"
>> set user_desktop to startup_disk & ":Users:" & User & ":Desktop:"
>> set output_folder to startup_disk & ":Users:" & User & ":Desktop:Output:"
>> try
>> tell application "Finder"
>> make new folder at user_desktop with properties {name:"Output"}
>> end tell
>> end try
>> set the_folder_list to list folder input_folder without invisibles
>> repeat with x from 1 to count of the_folder_list
>>
>> set the_file to input_folder & item x of the_folder_list
>> tell application "QuickTime Player 7"
>> activate
>> open the_file
>> repeat with myFormat in formatList
>> set {movFormat, movPreset, movExtension} to myFormat
>> set file_extension to "-lo." & movExtension
>> set output_file to output_folder & item x of the_folder_list & file_extension
>> with timeout of 600 seconds
>> export front document to output_file as movFormat using settings preset movPreset with replacing
>> end timeout
>> end repeat
>> close front document
>> end tell
>> end repeat
>> ----------
>> --FWIW, this is not at all how I'd write this script.
>> I'd reduce all the finder and path manipulation to two or three lines, and probably replace the original extension with the export extension, rather than just append.
>>
>>
>>
>> HTH,
>>
>> ES
_______________________________________________
Do not post admin requests to the list. They will be ignored.
AppleScript-Users mailing list (email@hidden)
Help/Unsubscribe/Update your Subscription:
Archives: http://lists.apple.com/archives/applescript-users
This email sent to email@hidden