.MKV to .MP4 with 2 soundtrack (audio)

.mp4ffmpegmatroska

I found this thread:
Handbrake settings to convert MKV to MP4 while retaining the original quality

And I can "convert" .MKV to .MP4 with the following code:

for %%a in ("*.mkv") do D:\Programme\Converter\ffmpeg\bin\ffmpeg.exe -i "%%a" -c:v copy -c:a copy "%%~na .mp4"
pause

The only problem is, that there are 2 audio lanes.
The german, and the english. With the code above, it only copies the german (1st) language. But not the 2nd audio language. How can I do that?

At the moment I just convert from .MKV to .MP4 with german lang only.
But I want to be able to switch the language with my VLC player from german to english.

Thanks for your help!

EDIT:
I found that thread here:
http://ffmpeg.gusari.org/viewtopic.php?f=25&t=611

And I tested with that informations.
I changed my code above, to this code:

for %%a in ("*.mkv") do D:\Programme\Converter\ffmpeg\bin\ffmpeg.exe -i "%%a" -map 0:0 -map 0:1 -map 0:2 -c:v copy -c:a:0 copy -c:a:1 copy "%%~na.mp4"
pause

Did I do something wrong here?
How could I add the german / english subtitles to that?
IF I would add a subtitle map thing there, and my .MKV have no subtitles at all, would this be a problem?
I just want to create a .bat file which converts a .MKV with 2 soundtracks and 2 subtitles. So that I can "remux" (or convert dunno) all my .MKV files to .MP4 without losing any informations.

At the moment, my .MKV have no subtitles, so it's not important. But it's better to prepare for the future, right?

So please tell me if I did it right, and perhaps how to add the subtitles too.
It's the first time I ever used FFmpeg. Just downloaded it, never heared about it. Never really used the CMD for that.

Best Answer

ffmpeg does not automatically map all tracks; default stream selection will only map one audio, one video, and one subtitle track to the output. If you want to map all streams, use -map 0. If you want to be able to select what to map, you'll have to parse the input file first (ffmpeg -i input.mkv) and use some scripting to construct the final conversion command. ffprobe can be helpful for that. See FFmpeg Wiki: FFprobe Tips for examples.

You can specify -c copy to stream copy all streams, no matter what type they are. You can also index video and audio streams separately, so your command can be shortened to:

ffmpeg -i input.mkv -c copy -map 0 output.mp4
Related Question