| | 290 | |
| | 291 | = Arbitrary channel reduction & mapping = |
| | 292 | |
| | 293 | The [https://ffmpeg.org/ffmpeg-filters.html#pan pan] audio filter can be used to reduce the number of channels in a stream with an arbitrary mapping of input to output channels. For example, given a multi-channel WAV input file captured from an audio interface, to extract channels 3 and 4 into a stereo output any of the following commands would work: |
| | 294 | |
| | 295 | {{{ |
| | 296 | ffmpeg -i in.wav -af 'pan=2c|c0=c2|c1=c3' out.wav |
| | 297 | ffmpeg -i in.wav -filter 'pan=2c|c0=c2|c1=c3' out.wav |
| | 298 | ffmpeg -i in.wav -filter_complex '[0:a] pan=2c|c0=c2|c1=c3' out.wav |
| | 299 | }}} |
| | 300 | |
| | 301 | Here, `2c` specifies that the output should have two channels, and `c0=c2` and `c1=c3` define the mapping of input to output channels. The channel numbers start at zero, thus we define (zero-based) output channels 0 and 1 to come from input channels 2 and 3, respectively. |
| | 302 | |
| | 303 | The `-filter_complex` version is only necessary when more than one filter is employed. |