Welcome to the MacNN Forums.

If this is your first visit, be sure to check out the FAQ by clicking the link above. You may have to register before you can post: click the register link above to proceed. To start viewing messages, select the forum that you want to visit from the selection below.

You are here: MacNN Forums > Software - Troubleshooting and Discussion > Applications > Applescriptin QT file exports: can it be done?

Applescriptin QT file exports: can it be done?
Thread Tools
Mac Elite
Join Date: Jan 2001
Status: Offline
Reply With Quote
Jun 16, 2004, 04:07 PM
 
Hello

Im looking to see if anyone understands applescript well enough to know if it is possible to set up a script that will take various individual QT movie files in a folder and export them individually to another place, say another HD or folder with a different compression ( same compression result for all, same file type to start).

I have many QT.mov files from my AlchemyDVR card that Id like to recompress to mp4's. but it takes about 20 min to do a 20 min file on my G$ dual 1 gz.

Id like to do them at night, say, go to this folder, take each file individually, export it to <here> as a QT.mp4

this would save me doing it manualy.

any ideas?
\
thanks Rotut
     
Professional Poster
Join Date: Oct 2001
Location: London
Status: Offline
Reply With Quote
Jun 16, 2004, 06:00 PM
 
Yes, you can do this - I'm not sure whether you need QT Pro though...

I've got a script (that looks like it's a script from Apple that I've butchered) that exports the foremost movie to a DV stream that you should be able to alter to your needs:

[php]
-- strip extension subroutine
on stripExtension(stripString)

set dotChar to "."
set cIndex to 0
set lastDotIndex to 0

repeat with curChar in stripString
set cIndex to (cIndex + 1)
if (curChar as Unicode text is equal to dotChar as Unicode text) then
-- log "found dot"
set lastDotIndex to cIndex
-- log lastDotIndex
end if
end repeat

set newString to (characters 1 thru (lastDotIndex - 1) of stripString as Unicode text)
return newString

end stripExtension





tell application "QuickTime Player"
activate

try
if not (exists movie 1) then error "No movies are open."

stop every movie

-- CHECK FOR THE CORRECT VERSION
set QT_version to (QuickTime version as string)
set player_version to (version as string)
if (QT_version is less than "5.0") or ¬
(player_version is less than "5.0") then
error "This script requires QuickTime 5.0 or greater." & ¬
return & return & ¬
"Current QuickTime Version: " & QT_version & return & ¬
"Current QuickTime Player Version: " & player_version
end if

-- CHECK FOR QUICKTIME PRO
if QuickTime Pro installed is false then
set the target_URL to "http://www.apple.com/quicktime/download/"
display dialog "This script requires QuickTime Pro." & return & return & ¬
"If this computer is currently connected to the Internet, " & ¬
"click the “Upgrade” button to visit the QuickTime Website at:" & ¬
return & return & target_URL buttons {"Upgrade", "Cancel"} default button 2
ignoring application responses
tell application "Finder"
open location target_URL
end tell
end ignoring
error number -128
end if


set movieName to the name of front movie
set originalMovieFile to original file of front movie

-- check to see if the opened movie can be exported
if (can export movie 1 as DV stream) is true then

tell application "Finder"
set parentFolder to container of originalMovieFile
set DVFileClassicPath to ((parentFolder as text) & my stripExtension(movieName) & ".dv")
end tell

-- export the movie as DV stream movie
try
export movie 1 to (file DVFileClassicPath) as DV stream using settings preset "DV PAL 48 kHz"
on error number exportErr
set dialogMessage to "unhandled error"
if exportErr is equal to -48 then
set dialogMessage to "The File '" & my stripExtension(movieName) & ".dv" & "' already Exists."
end if
display dialog dialogMessage & " (" & exportErr & ")" buttons {"OK"}
end try

else
error "This movie cannot be exported as a DV stream."
end if




on error error_message number error_number
if the error_number is not -128 then
beep
display dialog error_message buttons {"Cancel"} default button 1
end if
end try
end tell
[/php]

[edit] - I think it came from here initially:

http://www.apple.com/applescript/quicktime/
You know it makes sense. ☼ ☼ ☼ Growl.
     
   
Thread Tools
Forum Links
Forum Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts
BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On
Top
Privacy Policy
All times are GMT -5. The time now is 02:29 AM.
All contents of these forums © 1995-2011 MacNN. All rights reserved.
Branding + Design: www.gesamtbild.com
vBulletin v.3.8.7 © 2000-2011, Jelsoft Enterprises Ltd., Content Relevant URLs by vBSEO 3.3.2