How do I render a video with 2 languages, and have a video player like VLC choose between 2 audio tracks (i.e. 1 track for Japanese and the other for English)?
with three inputs (-i flag) -- a video file, and two audio files.
The streams are explicitly mapped into the result, counting the inputs from 0 -- i.e. -map 0:v maps input 0 (the first file) as video (v) to the output file and -map 1:a maps the next input as audio (a), etc.
It sets the metadata for the audio tracks -metadata:s:a:0 language=jpn sets the first audio track (again counting from 0...) to Japanese; the second metadata option sets the next audio track to English.
-c:v copy specifies that the video codec should be copied directly (i.e. don't re-encode -- remove this if you DO need to re-encode)
-c:a copy specifies that the audio codec should be copied directly (i.e. don't re-encode -- remove this if you DO need to re-encode)
output.mp4 -- finally, list the name of the file you want the result written into.
You can just use MKVToolNix to add the second track to the MKV file after rendering, it's still another step but doesn't require re-encoding.
If you're just trying to multiplex tracks and not actually edit the video, I'd recommend doing it entirely with MKVToolNix and skipping Kdenlive for this use. I've done this previously to combine a subbed video and a dubbed one into one file, you can offset or stretch the audio if needed as well.
Not rendering. Muxing, which is short for multiplexing. Lots of software can do this, including MKVToolNix, ffmpeg, and GPAC/MP4Box. If you're also encoding the video, Handbrake could do the job.