1
votes

on run {input, parameters} tell application "Terminal" activate set filesString to "" repeat with file_ in input set filesString to filesString & " " & quoted form of (POSIX path >of file_) end repeat do script "for f in" & filesString & "; do ~/Documents/ffmpeg/ffmpeg -i \"$f\" -acodec pcm_s16le \"${f%.*}.wav\" done" end tell return input end run

I wrote an applescript to add a right-click service in OS X, but this only takes the first channel and creates a mono wav file. How can i create a multichannel wav to accommodate 8 mono tracks?

1

1 Answers

3
votes

amerge

One method is to use the amerge filter:

ffmpeg -i input -filter_complex "[0:a:0][0:a:1][0:a:2][0:a:3][0:a:4][0:a:5][0:a:6][0:a:7]amerge=inputs=8" output.wav

join

Another method is to use the join filter:

ffmpeg -i input -filter_complex "[0:a:0][0:a:1][0:a:2][0:a:3][0:a:4][0:a:5][0:a:6][0:a:7]join=inputs=8:channel_layout=7.1" output.wav

join has the advantage over amerge of allowing you to have more control over which streams go where in output channel layout:

ffmpeg -i input -filter_complex "join=inputs=8:channel_layout=7.1:map=0.0-FL|1.0-FR|2.0-FC|3.0-LFE|4.0-BL|5.0-BR|6.0-SL|7.0-SR" output.wav

Notes

  • [0:a:5] refers to the 4th audio stream of input number 0 (the first and only input in this example).

  • You can omit the filter input labels ([0:a:0][0:a:1][0:a:2], etc) if you know you can trust the default stream selection behavior.

  • You can see a list of supported channel layouts with ffmpeg -layouts.