Jump to content
Sign in to follow this  
Followers 0
speedyrazor

Quicktime Audio Channel Assign - Left, Right, Front Left, LFE, etc

1 post in this topic

Recommended Posts

I am trying to adapt the below Applescript code to change the audio channel assignment of a multichannel Quicktime file consisting of video and 8 audio channels from the default 'Mono' to 'Left, Right, Front Left, Front Right, LFE', etc, which can be done manually from 'Show Movie Properties/Audio Settings. The below script successfully changes the audio channels 'name' but I want it to change the 'channels' assignment, but I can't figure out how to get it working. I am on Mavericks with Quicktime Pro 7.

on run
    open (choose file with prompt "Choose source file(s)" with multiple selections allowed)
end run

on open ff
    repeat with f in ff
        remap_sound_tracks_name(f's POSIX path)
    end repeat
end open

on remap_sound_tracks_name(f)
    (*
        string f : POSIX path of source movie file
    *)
    script o
        on map(n)
            set mm to {¬
                {"Sound Track 1", "Left"}, ¬
                {"Sound Track 2", "Right"}, ¬
                {"Sound Track 3", "Center"}, ¬
                {"Sound Track 4", "LFE Screen"}, ¬
                {"Sound Track 5", "Left Surround"}, ¬
                {"Sound Track 6", "Right Surround"}, ¬
                {"Sound Track 7", "Left Total"}, ¬
                {"Sound Track 8", "Right Total"} ¬
                    }
            repeat with m in mm
                if m's item 1 = n then return m's item 2
            end repeat
            return n
        end map

        set f to f as POSIX file
        tell application id "com.apple.quicktimeplayer" -- QuickTime Player 7
            set dc to count documents
            open f
            repeat until (count documents) > dc
                delay 0.2
            end repeat
            tell document 1
                repeat with t in (get tracks whose audio channel count > 0)
                    set t to t's contents
                    set n to t's name
                    set n1 to my map(n)
                    if n1 ≠ n then set t's name to n1
                end repeat
                if modified then save
                close
            end tell
        end tell
    end script
    tell o to run
end remap_sound_tracks_name

Share this post


Link to post
Share on other sites
Advertisement

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
Sign in to follow this  
Followers 0

  • Recently Browsing   0 members

    No registered users viewing this page.

×