1

I often download mp4 videos with multiple audio tracks. Is it any way or some tools with explanation to change default audio track ?

1

Use FFmpeg:

ffmpeg -i input.mp4 -map 0 -c copy -disposition:a:0 0 -disposition:a:1 default output.mp4

Audio tracks (streams) are numbered from 0.

Supposing the input video has 2 audio streams, and the default audio stream is 0, we need to

  • remove the “default” disposition from it (by setting it to 0: -disposition:a:0 0) and
  • set it to the audio stream 1 (by setting it to “default”: -disposition:a:1 default).

In general, remove the “default” disposition from all audio streams except one, and set it for it.


Note:

Not all media players honor default audio stream — for example Media Player Classic don't honor it (but you may set the preference by the language of audio streams), while VLC Media Player and FFplay do.


Proof (note the location of the “(default)” tag):

ffprobe -hide_banner input.mp4

gives (among others)

Stream #0:1(und): Audio: aac (LC) (mp4a / 0x6134706D), 48000 Hz, mono, fltp, 69 kb/s (default)
Metadata:
  handler_name    : SoundHandler
Stream #0:2(und): Audio: aac (LC) (mp4a / 0x6134706D), 44100 Hz, mono, fltp, 74 kb/s
Metadata:
  handler_name    : SoundHandler

while

ffprobe -hide_banner output.mp4

gives

Stream #0:1(und): Audio: aac (LC) (mp4a / 0x6134706D), 48000 Hz, mono, fltp, 69 kb/s
Metadata:
  handler_name    : SoundHandler
Stream #0:2(und): Audio: aac (LC) (mp4a / 0x6134706D), 44100 Hz, mono, fltp, 74 kb/s (default)
Metadata:
  handler_name    : SoundHandler

The numbering here numbers all tracks, so #0:0 (omitted from the FFprobe outputs) is the first (video) track, and #0:1 and #0:2 are audio tracks.

  • I tried it with different variants (from 1 to 4) but it does't work for me. Unfortunately. Default audio track stays the same. – Артур Гудиев Jan 8 at 7:48
  • I edited my answer — you also need to remove the “default” disposition from all other audio tracks. – MarianD Jan 8 at 15:16
  • Note that not all media players honor the “default” disposition — some of them simply start playing the first audio stream. – MarianD Jan 8 at 15:36
  • Thank you so much! I use VLC player. And the edited answer helped me! – Артур Гудиев Jan 8 at 16:57
1

Some media players simply start playing the first audio stream (track). For them you may simply change the order of audio streams.

For example, suppose you have 1 video stream and 3 audio streams in your input file, and you want to move the 3rd audio stream to be the first of audio streams.

Use

ffmpeg -i input.mp4 -map 0:v -map 0:a:2 -map 0:a:0 -map 0:a:1 -c copy output.mp4 

so -map 0:a:2 places the 3rd audio stream (stream numbers begin with 0, so 2 is the 3rd one) in front of all others audio streams (-map 0:a:0 -map 0:a:1).


Note:

  • 0:v means all video streams in the input file 0 (input files are numbered from 0)
  • 0:a:2 means: input file 0, audio stream number 2
  • 0:a:0 means: input file 0, audio stream number 0
  • 0:a:1 means: input file 0, audio stream number 1

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.