How can I either use applescript or Automator to batch export video files I have selected in Finder, but NOT using the "Encode Selected Video Files" service method, which only has 4 formats to choose from?

Basically, I need to export the videos either using the "Most Recent Settings" chosen the last time I exported a video from QuickTime 7, or to have some option to specify the settings using the export dialog in QuickTime 7 to choose the specific formatting I need for the videos I have selected.

Sometimes I need the codec to be "Apple ProRes 422 LT", and other times I need to use the regular "Apple ProRes 422". I'll also need to ensure the framerate is set to 30 regardless of the source file framerate, and the dimensions will either be 1280x720 or 1920x1080.

Lastly, I will also need to set different options for the audio encoding for different videos.

Hopefully someone knows a way to do this. I've been digging around here and on Google, and haven't been able to figure it out. It seems most of the info I'm finding online is just telling people how to use the same method, which is using the "Encode Selected Video Files" service.


Eureka! I found an Automator workflow online that actually works. I just had to modify it to take movie files as input instead of images. It uses the "Most Recent Settings" in QuickTime 7, so I just need to export the first video manually to get the settings entered properly, and the rest I can just select and batch. Hooray!

The original page I found with the info and workflow file is here: http://ptrbrtz.net/batch-convert-animated-gifs-to-videos-using-applescript-automator-quicktime-7-on-os-x/

I will add the script here as well in case the page I linked ever disappears. This just needs to be added in Automator as a service, with movie files from Finder as the input.

image showing how to add the service in Automator

And here's the AppleScript to add to the service. I just saved the service as "Export_mov_via_QuickTime7.workflow".

on run {inputFiles}
    if inputFiles is equal to {} then
        set inputFiles to (choose file with prompt "Select the file(s) to convert:" with multiple selections allowed without invisibles)
    end if
    open inputFiles
end run

on open droppedItems
    tell application "Finder" to set inputFolder to (container of first item of droppedItems) as Unicode text
    set outputFolder to (choose folder with prompt "Select output folder:" default location (inputFolder as alias)) as Unicode text

    display dialog "Most recent QuickTime 7 export settings will be used.
Existing files will be overwritten/moved to trash!
Beware of evil QT7 Gamma shift!"

    tell application "QuickTime Player 7"
        close every window
    end tell

    repeat with currentItem in droppedItems
        tell application "Finder" to set fileName to name of currentItem as Unicode text

        tell application "QuickTime Player 7"
            open currentItem
            tell front document to set frameCount to count of frames of first track
        end tell

        set outputFileName to (outputFolder & fileName & ".mov")

        tell application "Finder"
            if exists file outputFileName then
                delete file outputFileName
            end if
        end tell

        tell application "QuickTime Player 7"
            if frameCount is greater than 1 then
                with timeout of 86400 seconds -- 24 hours
                    export front document to outputFileName as QuickTime movie using most recent settings
                end timeout
            end if
            close front document
        end tell
    end repeat

    quit application "QuickTime Player 7"
end open

Now, anytime you want to batch export videos using QuickTime Player 7 Pro with whatever settings you choose, you just have to select all the other videos you want to export, select the service under the Finder->Services menu, and enjoy a nice coffee break while all of your videos are converted! =D

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.