The command I usually use in case of single audio stream mkv files to convert them to mp4 is:

ffmpeg -i location of mkv file\movie.mkv -c copy location of my usb stick\blablabla.mp4`

But when I did this command with an mkv file that had two audio sources, I ended up with no sound at all on TV and only English audio on PC, when I needed the Hungarian version. What is the command that converts mkv to mp4 while keeping only the audio source specified by me? If it's any help VLC says that audio track #2 is the Hungarian version.

  • Just use MKVToolnix (GUI version). – Robert May 13 at 17:28
  • I tried two GUIs yesterday, one of them threw an error that didn't let me convert it, and the other one converted it, but when it was done, it started converting it again without any commands from me, deleting the already converted file. I will give this one a shot. – lapartman May 13 at 17:31

Use the -map option to select specific streams.

First video stream, second audio stream:

ffmpeg -i input -map 0:v:0 -map 0:a:1 -c copy output

Or select all streams with Hungarian language metadata:

ffmpeg -i input -map 0:v:0 -map 0:a:m:language:hun -c copy output

I'm guessing your stream indexes in these examples, so you may have to adjust the actual values. Just probe the file first to see the details: ffmpeg -i input

  • Thank you, I will try this one first before screwing up again with bad GUIs. – lapartman May 13 at 17:33
  • Thanks dude, I converted the first few minutes and then stopped it to check and it was in Hungarian. I used your first command. – lapartman May 13 at 17:44
  • @llogan cus added recursive matching, so -map 0:a:m:language:hun now works. – Gyan May 13 at 18:09
  • @Gyan Thanks. Didn't notice that commit. Haven't been paying as much attention (and no longer subscribed to the MLs). – llogan May 13 at 18:22

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.