MacOS – Create video file with multiple audio tracks

audiomacosvideovideo editing

I have an animated movie in three different languages. The picture is exactly the same for each langauge, only the audio is different.

I want to merge all these files into one, so that I have a single video file where I can switch easily between the audio tracks in VLC.

Using OS X Yosemite, how can I create such a video file with multiple audio tracks?

Although I doubt it's possible, I'd also be open to doing this on iOS.

Best Answer

Since you are looking at playing it in VLC, I would suggest using MKVToolNix. It's a free, open-source set of tools to allow you to manipulate MKVs.

Let's go through it step-by-step (there is a shorter way but this will get you to learn a bit more about MKVTN):

  1. You're going to want to demux two of the videos with the foreign audio so drag it in to MKVTN's "Source Files" area. You'll see the file get listed and in the "Tracks, chapters, tags and attachments" view you will see the streams in that file. In my example below (forgive the Windows interface, but it's the same) you will see there is an AAC audio stream and an Mpeg-4 Hi10p video stream.

Adding file to MKVToolNix

  1. Deselect all tracks so that only the audio track you want to grab is selected.

Deselecting all non-relevant tracks

  1. You'll notice that the filename under "Output file" has changed its extension to .mka. This is because MKVTN knows we are exporting only audio. Choose where you want to save the output file, give it a name, and click "Start muxing".

Changed file extension

  1. Repeat this process until you have the video file with one audio and separate .mka files for each of the foreign audio tracks.

  2. Repeat step one, dragging in the original video file containing the first language.

  3. Drag in the separate .mka tracks to the same view. You will be presented with a popup like below.

enter image description here

  1. Since we want to use these files as input files too, we can leave the settings as they are and click "OK".

  2. In the "Tracks" view, you should now see multiple audio tracks for each of the different languages. (At this point I should note that you could have just dragged the video files all in and then just deselected the video tracks but I figured I'd get you to dummy run the program first ;) )

If you're happy with not having any other metadata set for the file then you can go ahead and repeat step 3 (setting the file name etc.) to export an .mkv containing all your audio with the video.

If you'd like to though, you can select each track in the "Tracks" view and specify the language of each and also which one should play by default by editing the attributes in the "Properties" view. This can help you differentiate later on in VLC when you want to switch the languages.

You may also find that if the audio files are different lengths and just stretched in their original containers that the audio may not sync up perfectly. You can adjust that via the "Properties" tab too if you know the offsets. If the source video was the same though, you may find it syncs up fine.

AFAIK, there's no similar tool for iOS, but it's not something I've thought of doing on iOS myself.

Let me know in the comments if there's something you want me to expand on. :)