on open objects repeat with obj in objects set tgPath to getPosixPath(obj) set aacPath to Replace(tgPath, "mp4", "aac") set cmd to "/Applications/ffmpeg -i " & tgPath & " -vn -acodec copy " & aacPath & "" do shell script cmd set m4aPath to Replace(tgPath, "mp4", "m4a") set cmd to "/Applications/mp4box -add " & aacPath & " " & m4aPath & "" do shell script cmd set aacPath to Replace(obj as string, "mp4", "aac") tell application "Finder" to delete alias aacPath end repeat end open to getPosixPath(theFile) return quoted form of POSIX path of theFile end getPosixPath on Replace(src, tg, rp) set oldDel to AppleScript's text item delimiters set AppleScript's text item delimiters to tg set myList to text items of src set AppleScript's text item delimiters to rp set myText to myList as string set AppleScript's text item delimiters to oldDel return myText end Replace