Multi-track audio files for VOD / Simulive


Kaltura Player supports the playback of multi-track audio files, as long as it’s prepared, ingested, and delivered correctly.

Prerequisites

For the files to be ingested and displayed (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

Client needs to create an mp4 file with one video track and multiple audio tracks, mixed/muxed in.
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
ID                                       : 2
Format                                   : AAC LC
Format/Info                              : Advanced Audio Codec Low Complexity
Codec ID                                 : mp4a-40-2
Duration                                 : 2 min 10 s
Source duration                          : 2 min 10 s
Bit rate mode                            : Constant
Bit rate                                 : 132 kb/s
Channel(s)                               : 2 channels
Channel layout                           : L R
Sampling rate                            : 44.1 kHz
Frame rate                               : 43.066 FPS (1024 SPF)
Compression mode                         : Lossy
Stream size                              : 2.01 MiB (21%)
Source stream size                       : 2.01 MiB (21%)
Title                                    : ISO Media file produced by Google Inc. Created on: 02/14/2019.
Language : English
Default                                  : Yes
Alternate group                          : 1
mdhd_Duration                            : 130101

 
Audio #2
ID                                       : 3
Format                                   : AAC LC
Format/Info                              : Advanced Audio Codec Low Complexity
Codec ID                                 : mp4a-40-2
Duration                                 : 2 min 10 s
Source duration                          : 2 min 10 s
Bit rate mode                            : Variable
Bit rate                                 : 85.5 kb/s
Maximum bit rate                         : 128 kb/s / 128 kb/s
Channel(s)                               : 2 channels
Channel layout                           : L R
Sampling rate                            : 48.0 kHz
Frame rate                               : 46.875 FPS (1024 SPF)
Compression mode                         : Lossy
Stream size                              : 1.33 MiB (14%)
Source stream size                       : 1.33 MiB (14%)
Language : English
Default                                  : No
Alternate group                          : 1
mdhd_Duration                            : 130091

 
Audio #3
ID                                       : 4
Format                                   : AAC LC
Format/Info                              : Advanced Audio Codec Low Complexity
Codec ID                                 : mp4a-40-2
Duration                                 : 2 min 10 s
Source duration                          : 2 min 10 s
Bit rate mode                            : Variable
Bit rate                                 : 88.2 kb/s
Maximum bit rate                         : 128 kb/s / 128 kb/s
Channel(s)                               : 2 channels
Channel layout                           : L R
Sampling rate                            : 48.0 kHz
Frame rate                               : 46.875 FPS (1024 SPF)
Compression mode                         : Lossy
Stream size                              : 1.37 MiB (14%)
Source stream size                       : 1.37 MiB (14%)
Language : Spanish
Default                                  : No
Alternate group                          : 1
mdhd_Duration                            : 130091

 
Audio #4
ID                                       : 5
Format                                   : AAC LC
Format/Info                              : Advanced Audio Codec Low Complexity
Codec ID                                 : mp4a-40-2
Duration                                 : 2 min 10 s
Source duration                          : 2 min 10 s
Bit rate mode                            : Variable
Bit rate                                 : 86.3 kb/s
Maximum bit rate                         : 128 kb/s / 128 kb/s
Channel(s)                               : 2 channels
Channel layout                           : L R
Sampling rate                            : 48.0 kHz
Frame rate                               : 46.875 FPS (1024 SPF)
Compression mode                         : Lossy
Stream size                              : 1.34 MiB (14%)
Source stream size                       : 1.34 MiB (14%)
Language : French
Default                                  : No
Alternate group                          : 1
mdhd_Duration : 130091
Audio #5
ID                                       : 6
Format                                   : AAC LC
Format/Info                              : Advanced Audio Codec Low Complexity
Codec ID                                 : mp4a-40-2
Duration                                 : 2 min 10 s
Source duration                          : 2 min 10 s
Bit rate mode                            : Variable
Bit rate                                 : 72.0 kb/s
Maximum bit rate                         : 128 kb/s / 128 kb/s
Channel(s)                               : 2 channels
Channel layout                           : L R
Sampling rate                            : 48.0 kHz
Frame rate                               : 46.875 FPS (1024 SPF)
Compression mode                         : Lossy
Stream size                              : 1.10 MiB (11%)
Source stream size                       : 1.10 MiB (11%)
Language : Chinese
Default                                  : No
Alternate group                          : 1
mdhd_Duration : 130091
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 is how:

  1. Play a multi-audio track with the Kaltura Player.
  2. Select the Settings icon.
  3. Select the desired language from the Audio options. 


To learn more, see Captions and Audio Tracks.

Was this article helpful?
Thank you for your feedback!
In This Article
Related Articles
Back to top

Never miss a thing!

Subscribe to our customer newsletter and our release notes updates, so you always get the best out of Kaltura.
Newsletter