Jump to content

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

quicktime applescript audio

  • Please log in to reply
No replies to this topic



    InsanelyMac Protégé

  • Members
  • Pip
  • 18 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
            end tell
        end tell
    end script
    tell o to run
end remap_sound_tracks_name

0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users

© 2017 InsanelyMac  |   News  |   Forum  |   Downloads  |   OSx86 Wiki  |   Designed by Ed Gain  |   Logo by irfan  |   Privacy Policy