0

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?

0
ffprobe -v 0 -of csv -show_streams infile.mp4 | awk '/stereo/, $0 = ":" $2' FS=,

Result

:2

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.