Create MPEG-TS with Multiple Audio Languages in FFmpeg

This guide explains how to use FFmpeg to package a video with multiple audio tracks into an MPEG-TS (.ts) container while assigning distinct language descriptors to each track. You will learn how to map multiple audio sources and apply the correct metadata tags so that media players can identify and switch between the language tracks.

The Basic FFmpeg Command

To create an MPEG-TS file with multiple audio tracks and distinct language descriptors, you must map the inputs correctly and use the stream metadata specifier (-metadata:s:a) to define the languages using ISO 639-2 three-letter codes (e.g., eng for English, spa for Spanish, fre for French).

Here is the template command:

ffmpeg -i video.mp4 -i audio_en.ac3 -i audio_es.ac3 \
-map 0:v:0 \
-map 1:a:0 \
-map 2:a:0 \
-c:v copy \
-c:a copy \
-metadata:s:a:0 language=eng \
-metadata:s:a:1 language=spa \
output.ts

Command Breakdown

Mapping Tracks from a Single Multi-Track Input

If your source file already contains multiple audio tracks and you want to remux them into an MPEG-TS container with updated language tags, use this command:

ffmpeg -i input.mkv \
-map 0:v:0 -map 0:a:0 -map 0:a:1 \
-c copy \
-metadata:s:a:0 language=eng \
-metadata:s:a:1 language=fra \
output.ts

In this variation, -map 0:a:0 and -map 0:a:1 pull the first two audio streams from the single input file, and the metadata tags label them as English and French (fra) respectively.