I have a MP4 file which contains two audio streams with language tags ger and fre. The only video stream it contains is tagged as eng.

The ffmpeg documentation quotes:

To pick the English audio stream:

ffmpeg -i INPUT -map 0:m:language:eng OUTPUT

In my case this does not work. It will instead output the only stream with tag eng (which is a video stream). This is consistent with: https://ffmpeg.org/ffmpeg.html#Stream-specifiers-1

However, is there an option to specify both

  • the stream type (v, a, ...)
  • and provide a metadata tag (e.g. language:eng)

for the same -map parameter?


Not directly possible. The parser for this doesn't account for a second qualifier. Workaround is to use a pipe

ffmpeg -i IN -map 0:a -c copy -f nut - | ffmpeg -i - -c copy -map 0:m:language:eng OUT
  • Could you please elaborate? What is "-f nut" for? In the second command, can positions of parameters "-c" and "-map" be switched? – Jack Miller Aug 7 '17 at 3:57
  • -f nut sets the output format of the first command to the NUT container. It accepts most codecs and can be written to a pipe, so I chose that. Yes, you can swap the order of c and map. – Gyan Aug 7 '17 at 4:58
  • How would I also include the video stream of the input file in the output file? – Jack Miller Aug 7 '17 at 8:56
  • Run ffmpeg -i IN -i OUT -map 0:v -map 1:a -c copy FINALOUT next – Gyan Aug 7 '17 at 9:17

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.