How to convert an MKV file to MP4 that has two audio streams and I only need one of them with ffmpeg

audioffmpegvideovideo conversionvlc-media-player

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.

Best Answer

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

Related Question