map based on specific type of stream
- by Steven Penny
Consider the following file
Input #0, mov,mp4,m4a,3gp,3g2,mj2, from 'infile.mp4':
Stream #0:0(und): Video: h264 (High) (avc1 / 0x31637661), yuv420p, 1920x1038
Stream #0:1(eng): Audio: aac (mp4a / 0x6134706D), 48000 Hz, 5.1, fltp, 386 kb/s
Stream #0:2(eng): Audio: aac (mp4a / 0x6134706D), 48000 Hz, stereo, fltp, 124 kb/s
I would like to run a command that uses the video and only the stereo audio.
With this particular file I could just run
ffmpeg -i infile.mp4 -c copy -map v -map :2 outfile.mp4
However this will not work if the audio streams are switched. How can I tell
FFmpeg to use the 2 channel audio only?