2025-10-14 10:04:00 EDT

M: I have an MKV file with three audio tracks. I actually have the command line using FFmpeg to swap two audio tracks, but evidently that's insufficient to bring the second track to be the primary track. When you've got three audio tracks. So please give me a command line to make the second audio track the first audio track in an MKV file without doing any conversion or anything, just remapping the streams.

G: Here’s the precise ffmpeg command you want — it remaps streams only, doing no re-encoding, and makes the second audio track the first (primary) while preserving all other streams:

ffmpeg -i input.mkv -map 0:v -map 0:a:1 -map 0:a:0 -map 0:a:2 -map 0:s? -c copy output.mkv

Explanation:

If you don’t care about subtitles, you can drop -map 0:s?.

Result: same MKV, streams just reordered, no quality loss.

2025-10-14 10:06:36 EDT

M: Okay, here's an anomaly. It certainly switched the first track and the second, but then it started up using the second audio track. Now, I'm using VLC, so it may have just automatically done that from when I was testing things out, and I'll try it again, but does this sound like something that could happen because of the file itself?

G: [Non-text content: thoughts; content_type=thoughts]

G: [Non-text content: reasoning_recap; content_type=reasoning_recap]

G: TL;DR: Yes—players don’t pick “track 1” just because it’s first. They usually honor MKV flags (default/forced) and language prefs, and VLC can also remember your last manual choice. Fix by setting the right disposition flags, not just reordering.

Why this happens

One-shot fix with ffmpeg (no re-encode)

This remaps streams (making the original 2nd audio first) and sets only the new first audio as default:

ffmpeg -i input.mkv \
  -map 0:v -map 0:a:1 -map 0:a:0 -map 0:a:2 -map 0:s? \
  -c copy \
  -disposition:a:0 default \
  -disposition:a:1 0 \
  -disposition:a:2 0 \
  output.mkv

Verify flags

ffprobe -hide_banner -loglevel error -select_streams a \
  -show_entries stream=index,disposition:stream_tags=language,title \
  -of default=nw=1 input.mkv

Look for disposition:default=1 on the one you want.

Lossless header edit alternative (no remux)

If you prefer to edit in place:

  1. Get track IDs:
mkvmerge -i input.mkv
  1. Set flags:
mkvpropedit input.mkv \
  --edit track:a1 --set flag-default=1 --set flag-forced=0 \
  --edit track:a2 --set flag-default=0 --set flag-forced=0 \
  --edit track:a3 --set flag-default=0 --set flag-forced=0

VLC sanity checks

This will make the second track truly “primary” for players that honor MKV defaults.