Set Default or Forced Audio Flags in MKV Using FFmpeg
Managing multiple audio tracks in an MKV (Matroska) container often requires setting specific tracks as “default” or “forced” to ensure media players play the correct audio automatically. This guide provides a direct, step-by-step walkthrough on how to use the FFmpeg command-line tool to modify these metadata flags quickly without re-encoding your video or audio files.
Understanding the FFmpeg Disposition Option
FFmpeg uses the -disposition flag to control track
properties like default and forced. To change
these flags without wasting time or losing quality to re-encoding, you
must use the -c copy parameter. This instructs FFmpeg to
copy the video, audio, and subtitle streams directly into the new
container.
Audio tracks in FFmpeg are indexed starting from zero. The first
audio track is represented as a:0, the second as
a:1, and so on.
How to Set an Audio Track to Default
To set the first audio track (a:0) as the default track
while copying all streams without re-encoding, use the following
command:
ffmpeg -i input.mkv -c copy -disposition:a:0 default output.mkvHow to Set an Audio Track to Forced
The “forced” flag is typically used for audio tracks that contain
translations or foreign language dubs that must be played. To mark the
first audio track (a:0) as forced, use this command:
ffmpeg -i input.mkv -c copy -disposition:a:0 forced output.mkvHow to Configure Multiple Audio Tracks Simultanously
If your MKV file has multiple audio tracks, you may want to set one track as the default and explicitly strip the default flag from the other tracks to prevent player confusion.
To make the first audio track (a:0) the default and
disable the default status on the second audio track (a:1),
use 0 to clear the flag:
ffmpeg -i input.mkv -c copy -disposition:a:0 default -disposition:a:1 0 output.mkvYou can also combine different flags. For example, to make the first audio track default and the second audio track forced:
ffmpeg -i input.mkv -c copy -disposition:a:0 default -disposition:a:1 forced output.mkv