[FFmpeg-user] Extract all audio regardless of stream/channel count

Marton Balint cus at passwd.hu
Sat Feb 11 00:49:32 EET 2017

On Fri, 10 Feb 2017, Carles Vila wrote:

> Hi,
> I'd like to know if there is a simple way (script) to extract all audios
> individually from a video. The video could have N stereo streams (normally
> up to 16), M mono streams (up to 16),
> or a combination of both. Now I have to write the -map structure manually
> after probing the input. Ideally I need to end up with as many mono wavs as
> individual channels.
> If you could give me a starting point, I could probably figure out.

I think you can only do this by dynamically generating the command line 
based on the probed input. So yes, you should write a script which first 
probes the input streams with ffprobe (there are many output formats: xml, 
json), then your script should determine the command line based on the 
number of channels in yout input streams, and finally the script should
execute ffmpeg with the proper command line.


More information about the ffmpeg-user mailing list