[MacDV] Re: dead simple question

Laine Lee llee at moss.utsa.edu
Tue Dec 30 10:00:12 PST 2003


Here's information and a version of the script that will let you drag and
drop the source movie. It will also give you a little flexibility about what
size files you create. Remember, it requires QuickTime Pro, enough disk
space and time to do the copying. You paste it into Script Editor and save
it as an application (you'll be prompted for the default destination for
movie chunks when you save or compile).

 Apple updated this article on the Knowledgebase recently:

http://docs.info.apple.com/article.html?artnum=93494

It tells you that iMovie can't import files larger than two gigabytes in
size and links a page that tells you how to split files into smaller chunks
if you have QuickTime Pro. Here's an Applescript I wrote that will do the
job for you automatically. Save it as a application with the Script Editor
and drag your big movie files onto the application's icon. You'll be
prompted for a folder for saving the resulting split movie chunks into. If
you want to change the output folder, just open and save the application
again using the script editor. This script also requires QuickTime Pro (5 or
higher) and can take quite a long time to work if your dragged file is
really big.


-------

property mydestination : choose folder with prompt ¬
    "Choose a destination folder for the segments."

on open sourcefile
    set this_time to 1
    
    tell application "QuickTime Player"
        activate
        stop every movie
        try
            if exists movie 1 then close movie 1
            
            -- CHECK FOR THE CORRECT VERSION OF QUICKTIME
            set the QT_version to (the QuickTime version as string)
            set the player_version to (the version as string)
            set the required_version to "5.0.2"
            if (the QT_version is less than the required_version) or ¬
                (the player_version is less than the required_version) then
                set the error_message to ¬
                    "This script requires QuickTime " & ¬
                    the required_version & "  or greater." & ¬
                    return & return & ¬
                    "Current QuickTime Version: " & QT_version & return & ¬
                    "Current QuickTime Player Version: " & player_version
                my upgrade_QT(error_message)
            end if
            
            -- CHECK FOR QUICKTIME PRO
            if QuickTime Pro installed is false then
                set the error_message to "This script requires a
            QuickTime Pro installation on this system."
                my upgrade_QT(error_message)
            end if
            
            set myfile to open sourcefile
            
        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
        
        --if not (exists movie 1) then error "No movies are open."
        
    end tell
    repeat
        activate
        display dialog ¬
            "Enter the number of seconds for segments.
            560 should make them less than 2 G in size." default answer ¬
            "560" buttons {"Cancel", "Set Segment Length"} default button 2
        copy the result as list to {segment_length_in_seconds, go_ahead}
        try
            if the segment_length_in_seconds is not "" then
                set the segment_length_in_seconds to the ¬
                    segment_length_in_seconds as number
                exit repeat
            end if
        end try
    end repeat
    
    
    repeat
        try
            tell application "QuickTime Player"
                
                tell movie 1
                    set the selection end to (the selection start + ¬
                        (segment_length_in_seconds * time scale))
                end tell
                if (data size of movie 1) > 0 then
                    set start_name to name of movie 1
                    cut movie 1
                    make new movie
                    paste movie 1
                   
                    set mynewfile to ((mydestination as string) & ¬
                        start_name & "_" & this_time)
                    with timeout of 3600 seconds
                        export movie 1 to file (mynewfile & ".dv") ¬
                            as DV stream using most recent settings
                    end timeout
                    close movie 1 without saving
                else
                    error number -128
                end if
            end tell
            set this_time to (this_time + 1)
        on error
            tell application "QuickTime Player"
                activate
                if (data size of movie 1) > 0 then
                    with timeout of 3600 seconds
                        export movie 1 to file (((mydestination as string) &
this_time) & ".dv") ¬
                            as DV stream using most recent settings
                    end timeout
                    close movie 1 without saving
                else
                    close movie 1 without saving
                end if
            end tell
            exit repeat
        end try
    end repeat
end open

on upgrade_QT(passed_message)
    tell application "QuickTime Player"
        activate
        stop every movie
        set the target_URL to "http://www.apple.com/quicktime/download/"
        display dialog passed_message & return & return & ¬
            "If this computer is currently connected to the Internet, " & ¬
            "click the ?pgrade?button to visit the QuickTime Website."
buttons ¬
            {"Upgrade", "Cancel"} default button 2
        ignoring application responses
            tell application "Finder"
                open location target_URL
            end tell
        end ignoring
        error number -128
    end tell
end upgrade_QT

-------
-- 
Laine Lee
llee at lonestar.utsa.edu
http://lonestar.utsa.edu/llee
 




More information about the MacDV mailing list