Is there a way in ffmpeg to extract all audio channels giving each a separate name?
The problem is that I don't know in advance how many channels the input file is going to have.
This does splitting into two wav files:
ffmpeg -y -i input.wav -filter_complex
"[0:a]channelsplit=channel_layout=stereo[left][right]" -map "[left]"
left.wav -map "[right]" right.wav
What can be done if the input file contains 3, or 8 channels?
Ideally, I would like to have a way to convert Nchannels.mp4 into Nchannels_1.wav, Nchannels_2.wav, ..., Nchannels_N.wav.
You will have to do this in multiple steps.
ffprobe:
ffprobe -v error -show_entries stream=channels,channel_layout -of default=nw=1 input.wav
channels=6
channel_layout=5.1
ffmpeg -layouts to get channel names so you know what to name the outputs; as in the example below.ffmpeg command using results from ffprobe:
ffmpeg -i input.wav -filter_complex "channelsplit=channel_layout=5.1[FL][FR][FC][LFE][BL][BR]" -map "[FL]" front_left.wav -map "[FR]" front_right.wav -map "[FC]" front_center.wav -map "[LFE]" low_frequency_effects.wav -map "[BL]" back_left.wav -map "[BR]" back_right.wav
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With