About
Kaltura Player supports the playback of multi-track audio files, as long as they're prepared, ingested, and delivered correctly.
Prerequisites
For the files to be ingested and heard correctly in the player, a matching transcoding profile needs to be in place to ingest and transcode the additional language tracks. Each audio track should have a corresponding language flavor, in the account’s transcoding profile.
Configuring your account to enable multi-audio tracks requires PS setup; please contact your CSM for assistance.
Creating a multi-track audio file
The client needs to create an mp4 file with one video track and multiple audio tracks, mixed in (muxed). Additionally, the extra audio tracks need to be notated with the correct language code, for each track. The language notations are in the ISO 636-2 language codes (3 letters).
Creating mp4 files with multiple audio tracks can be achieved using some NLEs, AV encoders, and command line tools (FFmpeg, MP4Box…)
The following shell script uses FFmpeg to add English, Spanish, French, and Chinese to an existing mp4 file. The command below is a minimum working example. You will most probably need to adjust the inputs, processing, and output to make it work.
#!/bin/bash
# Input/Output
input=path/to/source/video.mp4
output=path/to/target/video.mp4
# Language tracks
file1=path/to/audio/english.aac
file2=path/to/audio/spanish.aac
file3=path/to/audio/french.aac
file4=path/to/audio/chinese.aac
# Language notations
lang0=eng
lang1=eng
lang2=spa
lang3=fre
lang4=zho
# Mixing command
ffmpeg -i "$input" \
-i "$file1" \
-i "$file2" \
-i "$file3" \
-i "$file4" \
-map 0 -map 1 -map 2 -map 3 -map 4 -shortest \
-metadata:s:a:0 language=$lang0 \
-metadata:s:a:1 language=$lang1 \
-metadata:s:a:2 language=$lang2 \
-metadata:s:a:3 language=$lang3 \
-metadata:s:a:4 language=$lang4 \
-codec copy -y "output"
Inspecting the file for audio tracks (optional)
After creating your multi-track audio file, play and inspect it to verify it’s working.
In VLC, go to the Window menu → Media Information → Codec Details.
You should see multiple audio streams after the video stream.
In MediaInfo, you should see something similar to this:
Audio #1
|
Notice there are several audio tracks - #1, #2, #3, #4, #5, each with a language identifier.
Playing multi-audio tracks
If several audio tracks are available on the media, Kaltura Player detects them automatically and enables users to effortlessly choose the preferred audio track. Here's how:
- Play a multi-audio track with the Kaltura Player.
- Select the Settings icon.
- Select the desired language from the Audio options.
To learn more, see Captions and Audio Tracks.