Published on August 30, 2023 (over 1 year ago)

Parlez-vous anglais? Introducing multi-track audio

Phil CluffLamia Chlala
By Phil and Lamia4 min readProduct

A trend that’s been interesting to watch in recent years is the silent disco, which brings people together to share a dance party — with a twist: everyone is listening to their own choice of music, through headphones. Partygoers get to enjoy their time together, with the experience that’s right for them. One person may be jamming out to the latest Taylor Swift tune, while their neighbor is taking it old school with a hit from the ‘80s.

Multi-track audio is a little like that. It enables you to take your on-demand video from a singular experience to the experience that is right for your viewer. In some cases, this might mean providing different language tracks so your global audience can enjoy the video in their preferred language. Or it might mean enhancing your content with a director’s commentary to share insight with viewers about what’s happening behind the scenes.

Are you streaming a fitness class? Building a meditation app? Maybe a viewer would like to turn down the music to hear the instructor better. Or maybe they want to pump up the tunes or hone into that ambient music while the instructor speaks in the background. You can use multi-track audio to provide different pre-mixed tracks to build different viewer experiences.

No matter what type of experience you’re creating, you can use multi-track audio to increase the accessibility of your videos by including a track with audio descriptions of the content on the screen for viewers who are blind or visually impaired.

Director's note: Multi-track audio is different from multi-channel audio. Multi-channel audio is a way of delivering sound so that different channels are assigned to different speakers to create an immersive audio experience (think: surround sound).

Multi-track audio is available today for on-demand assets on all Mux Video accounts.

LinkUsing multi-track audio

Below is a quick guide to getting started with multi-track audio, you can find full details in the documentation.

LinkSet the language of the primary audio track when you upload your video file

(Optional but highly recommended)

When you ingest your video file, you can now set the language and name of the primary audio track embedded within that video file.

json
// POST https://api.mux.com/video/v1/assets { "input": [ { "url": "https://example.com/video-with-primary-audio.mp4", "language_code": "en-GB", "name":"English" } ], "playback_policy": "public" }

You can still use multi-track audio with Assets that don't have a language or name set on your initial upload; we'll just call your primary audio track "Default," with no language.

LinkAdd your alternate audio track(s)

Once you've created your asset with a primary audio track, you can add alternate audio tracks using the asset tracks API. This is the same API that you can use to add captions to your assets.

json
// POST https://api.mux.com/video/v1/assets/${ASSET_ID}/tracks { "url": "https://example.com/alternate-audio.m4a", "type": "audio", "language_code": "fr", "name": "Français" }

You always need to specify the language code for an alternate audio track, but the name is optional. If you don't specify it, we'll generate it for you based on the language code you provided.

LinkPlay your videos with multi-track audio

When the alternate audio track has been processed, Mux will automatically add it to the playback URL for your asset.

Many video players already support multi-track audio right out of the box, including Mux Player, Video.js, ExoPlayer, and AVPlayer. So just drop your usual playback URL into your favorite video player, and click play.

Switching between audio tracks differs in each video player, but this will usually be a menu on the bottom right allowing you to change the track. For the example above in Mux Player, you need to click the waveform icon.

If your player doesn't support alternate audio tracks, you'll just hear the primary audio track.

LinkCost

Any primary audio track uploaded with your video file will be included with the encoding, storage, and delivery cost as part of your video. Any alternate audio tracks uploaded will be charged at the audio-only rates for encoding, storage, and delivery.

LinkFeedback

We’d love to hear about what experiences you’re building with multi-track audio as well as any feedback you may have. Just shoot us a note at info@mux.com.

Written By

Phil Cluff

Phil has spent the last 10 years building some of the biggest AVOD, SVOD, and public service streaming platforms in the world at the BBC and Brightcove. He’s here to chew gum and stream video, and he’s all out of gum.

Lamia Chlala

Previously office manager at Zencoder and product marketer at Brightcove. She can often be found geeking out over CSS and experimenting in the kitchen.

Leave your wallet where it is

No credit card required to get started.