List of contents:
- How to Encode Multiple Audio Tracks
- How to Serve Multiple Audio Tracks
- How to Use Multiple Audio Tracks with FV Player
Adding multiple audio tracks to your videos opens up a world of possibilities. You can make your video available for as wide range of people as possible, or cater to the specific needs of your users. Subtitles are important, but sometimes they are simply not enough.
Whether you want to include various language speakers, add a curated commentary to your short film, or even provide your music students with various layers of a song, that’s where multiple audio tracks come into play.
How to Encode Multiple Audio Tracks
Note: For Amazon Web services, the encoding happens in Mediaconvert. If you’re using AWS, click here.
In order to stream a video with multiple audio tracks, you will need to add the tracks prior to hosting it anywhere. While the tracks are supported in many formats, not all software offers the feature to include them. After carefully considering the options, we recommend using the lightweight, free and open-source tool MKVToolNix, mainly due to it’s ease of use and availability across all platforms. Avidemux can also be used, but it proves to be a bit less flexible in terms of audio.
- Download MKVToolNix here, install and open it.
- Right-click and pick Add files to add the video you wish to edit:
- Now follow the same process to add your first audio track.
- Once the additional audio track is there, you will see all the tracks and other parts (such as chapters, etc.) in the bottom left field:
- The video in mp4 format.
- The original audio track present in the video.
- The .mp3 audio track we have just added.
- Make sure to pick the track you want to edit in the bottom field. Now you can edit it on the right side:
- Define the track’s name.
- Define the language tag.
- Add other common flags and much more.
- To define language, click the edit icon next to “Language”:
- Now you can pick a tag from the drop-down menu, or even insert the tag as free form:
- Repeat the tagging process for all the other tracks you wish to add. Make sure to set “Default audio” flag to Yes for the audio you wish to be default. And to No for all the other tracks:
- Review and click Start Multiplexing:
- If you want to make sure, or if something went wrong, you can see the details of the job right-clicking the status bar in bottom right corner and picking show job output:
- Upload the audio files to your S3 bucket.
- Prepare the video input and outputs as per this guide.
Go to Input and configure audio selectors.Choose selector type based on your needs and preferences (Language code, track, PID).
You can add as many of them as you need by clicking Add audio selector.
We recommend you add the audio files from your S3 bucket, as it is the easiest way. Browse S3 in the external file field.
Now go over to the output group. You will need new outputs for each audio track. Do not add the audio into existing video outputs.
Remove audio from encoding settings of all the video quality outputs, and remove video from encoding settings of audio inputs.
This is an output group with a single video and 3 audio outputs:
In each audio output, go to Output Settings -> Audio. Put in an arbitrary Audio group ID.
The Audio group ID must be the same in all audio outputs.
Then select the Audio track type – “Alternate audio, auto select, default” for the default audio and “Alternate audio,auto select, not default” for all the rest.
- Underneath, in Encoding Settings -> Audio Source Select the correct number of Audio Selector created in step 3. None of the other encoding settings are required for this purpose.
Double check, if all selectors have correct audio source and the same Audio group ID.
- Finally, go into all the video outputs. There, go to Output settings -> Advanced. Write the Audio group ID you set in step 5. to the Audio rendition sets. In this case, our audio group ID is simply called “Audio”:
The tracks present in our project at the moment are as follows:
Not all hosting services support using multiple audio tracks. You will also want to encode the files into an HLS Stream to ensure that all browsers will be able to play the video properly.
Vimeo and YouTube do not support multiple audio tracks as of yet. YouTube is currently testing this feature and it could be available to the general public fairly soon.
FV Player Coconut
We recommend using Coconut, as it fully supports multiple audio tracks and you do not need to do anything special.
Encode your video with multiple audio tracks into an HLS Stream via the free FV Player Coconut as you always would and insert the link into the FV Player shortcode editor.
Amazon Web Services
Amazon Web Services supports multiple audio tracks too. With AWS, you do not need to use software, as the multiple audio tracks encoding happens all in the Mediaconvert console.
AWS requires you to set an arbitrary Name modifier – this will be appended to the file name.
How to Use Multiple Audio Tracks With FV Player
Just insert the link to the shortcode editor as you would a normal video, and FV Player will recognize the multiple audio tracks automatically.
Once posted, the video will have an AUD button on the controlbar, allowing you to switch between the audio tracks.