Want to put both Japanese and English audio into a single video so viewers can switch between them, or add a commentary track as a secondary audio? FFmpeg handles this kind of multilingual, multi-track management. This article covers creating, adding, extracting, and removing multiple audio tracks, tagging them with language codes such as jpn/eng, designating a default audio track, and the differences in support between MKV and MP4.

Tested with: FFmpeg 6.1 (verified against real FFmpeg) / Target OS: Windows / macOS / Linux


Why You Need Multiple Audio Tracks

Multiple audio tracks are used in scenarios like these:

  • Multilingual support (Japanese and English dubs)
  • Audio commentary (a film’s secondary audio)
  • Different audio formats (storing both AAC and Dolby AC-3)
  • Bundling stereo plus 5.1ch surround into a single file

Inspect Stream Information

First, check how many audio tracks the input file contains:

ffprobe -v quiet -show_streams -select_streams a input.mkv

Combine Two Audio Files into One Video

ffmpeg -i video.mp4 -i audio_ja.aac -i audio_en.aac \
  -map 0:v:0 \
  -map 1:a:0 \
  -map 2:a:0 \
  -c:v copy -c:a copy \
  output_bilingual.mkv
  • 0:v:0 — the video stream of input 0 (video.mp4)
  • 1:a:0 — the audio stream of input 1 (audio_ja.aac)
  • 2:a:0 — the audio stream of input 2 (audio_en.aac)

Set Language Metadata

ffmpeg -i video.mp4 -i audio_ja.aac -i audio_en.aac \
  -map 0:v:0 \
  -map 1:a:0 \
  -map 2:a:0 \
  -c copy \
  -metadata:s:a:0 language=jpn \
  -metadata:s:a:1 language=eng \
  output.mkv

-metadata:s:a:0 sets the metadata for the zeroth audio stream. Use ISO 639-2 (three-letter) codes for the language values (jpn, eng, fra, deu, and so on).


Set the Default Audio Track

ffmpeg -i input.mkv \
  -c copy \
  -disposition:a:0 default \
  -disposition:a:1 0 \
  output.mkv
  • -disposition:a:0 default — mark the zeroth audio as the default
  • -disposition:a:1 0 — clear the default flag on the first audio

Add an Audio Track to an Existing Video

ffmpeg -i existing.mp4 -i new_audio.aac \
  -map 0 \
  -map 1:a \
  -c copy \
  output_added.mkv

In addition to -map 0 (all streams of the existing file), this adds -map 1:a (the new audio).


Extract Only a Specific Audio Track

ffmpeg -i input.mkv -map 0:a:1 -c:a copy audio_track2.aac

This extracts the second audio track (index 1, counting from zero).


Remove a Specific Audio Track

Use negative mapping to exclude a specific track:

ffmpeg -i input.mkv -map 0 -map -0:a:1 -c copy output.mkv

This outputs the result of taking -map 0 (all streams) and subtracting -map -0:a:1 (excluding the second audio).


Convert the Codec of an Audio Track

Here is an example that encodes the first audio to AAC while copying the second:

ffmpeg -i input.mkv \
  -map 0:v -map 0:a:0 -map 0:a:1 \
  -c:v copy \
  -c:a:0 aac -b:a:0 192k \
  -c:a:1 copy \
  output.mkv

With -c:a:0 and -c:a:1 you can specify the codec for each audio stream individually.


Caveats with MP4

MP4 has more limited support for multilingual tracks than MKV:

FeatureMKVMP4
Multiple audio tracks◯ Supported◯ Supported (but watch compatibility)
Language tags
Text-based subtitles◯ (ASS/SRT)△ (mov_text format)
Unlimited track count△ (player-dependent)

For long-term archival of multiple audio tracks, MKV is recommended.


Common Problems

The File Became Too Large After Adding an Audio Track

Use -c:a copy to copy the audio without re-encoding. Note, however, that if the existing track and the new track use different formats, you should watch out for MP4 compatibility.

The Player Doesn’t Recognize a Specific Audio Track

Set the first track as the default with -disposition:a:0 default, or check the track-selection settings on the player side.


List Audio Track Information

ffprobe -v quiet -show_streams -select_streams a \
  -show_entries stream=index,codec_name,channels:stream_tags=language \
  -of csv input.mkv


Primary sources: ffmpeg.org/ffmpeg.html#Stream-specifiers-1 / trac.ffmpeg.org/wiki/Map


FAQ

How do I keep a video that has multiple audio tracks?

Use -map 0:a to copy all audio streams. Combining it with -c copy lets you output even faster and without any quality loss.

I want to switch between Japanese and English audio

When outputting, attach a language tag to each audio track, such as -metadata:s:a:0 language=jpn, so that compatible players (VLC / mpv / Plex) let you switch from a menu.

Can I use multiple audio tracks in MP4?

Yes, MP4 supports multiple audio tracks. However, older iPhones and email apps can only play the first audio track, so check your delivery environment.

I want to specify which audio plays by default

Set it with the disposition flags, like -disposition:a:0 default -disposition:a:1 0. This means the zeroth audio is the default and the first is not.

I want to downmix 5.1ch to 2ch

-ac 2 automatically performs a stereo downmix. For finer control, use -af "pan=stereo|FL=...|FR=...".