Answers.Body: <p>Based on <a href="https://stackoverflow.com/questions/26956762/ffmpeg-set-subtitles-track-as-default/35235287#35235287">this answer on stackoverflow</a>, it seems that changing the disposition is now possible with ffmpeg (see also <a href="https://ffmpeg.org/ffmpeg.html" rel="nofollow noreferrer">the official documentation</a>).</p>
  <p>I think that the command that you would need, so that the final file had English as the default audio stream is:</p>
  <pre><code>ffmpeg -i movie.mkv -i audio.dts -map 0:v:0 -map 1:a:0 -map 0:a:0 -c copy -disposition:a:0 default -disposition:a:1 0 movie_combined.mkv
  </code></pre>
  <p>The addition is <code>-disposition:a:0 default -disposition:a:1 0</code>. The numbering of the streams is for the output. <code>-disposition:a:1 0</code> is needed to remove the disposition from the second stream.</p>
  <p>(Instead of <code>-disposition:a:1 0</code> you could also, in principle, use the non-documented <code>-disposition:a:1 none</code>, which has the same effect.)</p>
  <p>To add metadata/language information, see the <a href="https://video.stackexchange.com/a/19644/18877">other answer</a>.</p>
  
Answers.ContentLicense: CC BY-SA 3.0
Answers.CreationDate: 2017-05-10T05:10:44.767Z
Answers.Text: Have you tested this? At the time of my answer, `-disposition` was added but didn't work with MKVs.
Answers.UserDisplayName: Gyan
Answers.ContentLicense: CC BY-SA 3.0
Answers.CreationDate: 2017-05-10T10:20:50.067Z
Answers.Text: Yes, I have tested this (using ffmpeg on Ubuntu 16.04) with MKVs and it did work. The changed disposition was recognised by both ffmpeg itself (`ffmpeg -i previous_output_file.mkv`) and a mediaplayer.
Answers.UserDisplayName: aplaice
Answers.ContentLicense: CC BY-SA 4.0
Answers.CreationDate: 2020-07-16T23:10:24.863Z
Answers.Text: for people stumbling over this (like me): the [ffmpeg doc](https://ffmpeg.org/ffmpeg.html) now has `-disposition` and says, that you should use `0`to delete the disposition. `none` is not listed there, maybe unknown values are simply mapped to `0`.
Answers.UserDisplayName: Jakob
Answers.ContentLicense: CC BY-SA 4.0
Answers.CreationDate: 2020-07-17T11:58:54.243Z
Answers.Text: Thanks for the information! It's great that `-disposition` is now documented. `none`, despite indeed not being mentioned there, still seems to work. It's not just the case that unknown values are mapped to `0` — using any other value results in an error message. I've edited the answer, but kept mention of `none` in case there are old versions of `ffmpeg` which accept `none` but not `0`. (It's unlikely, but I don't want to test all old versions or trawl the git history...)
Answers.UserDisplayName: aplaice
Answers.ContentLicense: CC BY-SA 4.0
Answers.CreationDate: 2017-05-09T22:27:03.167Z
Answers.LastActivityDate: 2020-07-17T11:51:52.020Z
Answers.LastEditDate: 2020-07-17T11:51:52.020Z
Answers.UserDisplayName: aplaice
Answers.Body: <p>For language, add <code>-metadata:s:a:0 language=eng</code>.</p>
  
  <p>FFmpeg doesn't set or alter track dispositions in MKV. Use <a href="https://mkvtoolnix.download/doc/mkvpropedit.html" rel="nofollow">mkvpropedit</a>.</p>
  
  <p>To set the default flag for the first audio track and remove it from the second one, use this command:</p>
  
  <pre><code>mkvpropedit movie.mkv --edit track:a1 --set flag-default=1 --edit track:a2 --set flag-default=0
  </code></pre>
  
  <p>As mentioned in the docs, the app "<em>does not set the 'default track flag' of other tracks to '0' if it is set to '1' for a different track automatically.</em>" This is salient because FFmpeg sets default flags for all tracks to <code>1</code> unless the input has it different.</p>
  
Answers.ContentLicense: CC BY-SA 3.0
Answers.CreationDate: 2016-10-24T02:06:38.433Z
Answers.LastActivityDate: 2016-10-24T13:14:19.827Z
Answers.LastEditDate: 2016-10-24T13:14:19.827Z
Answers.UserDisplayName: Gyan
Body: <p>I want to mux (combine) two files into one <code>mkv</code> file. The first one is an <code>mkv</code> file that contains a video and an audio stream in German. The second one is an English audio stream in <code>dts</code> format.I want one <code>mkv</code> file that contains both audio channels, the English one being the first and default audio stream.</p>
  
  <p>Here's the ffmpeg command I'm using so far:</p>
  
  <pre><code>ffmpeg -i movie.mkv -i audio.dts -map 0:v:0 -map 1:a:0
  -map 0:a:0 -c copy movie_combined.mkv
  </code></pre>
  
  <p>This produces acceptable results. I get an <code>mkv</code> file that has two audio channels, the first one English, the second one German. However, there's two problems. The second (German) audio stream is still the default stream (VLC media player uses it by default and according to MediaInfo, there's a default flag on the stream). Also, the English stream doesn't show up as English, according to MediaInfo there's no language information for that stream.</p>
  
  <p>How do I flag the English audio stream as the default one? And how do I add the language information for that stream (so that, for example, it shows up as English in the audio track selection of VLC media player)?</p>
  
Comments.ContentLicense: CC BY-SA 3.0
Comments.CreationDate: 2016-10-22T16:20:10.377Z
Comments.Text: For language, add `-metadata:s:a:0 language=eng`. FFmpeg doesn't set or alter track dispositions in MKV. Use [mkvpropedit](https://mkvtoolnix.download/doc/mkvpropedit.html).
Comments.UserDisplayName: Gyan
Comments.ContentLicense: CC BY-SA 3.0
Comments.CreationDate: 2016-10-22T16:51:14.757Z
Comments.Text: @Mulvya Thanks, the metadata tag works. Can you explain what it does / how that parameter takes it's input? And do you know what command I need to use with mkvpropedit to set the default audio stream flag? Feel free to post that as an answer so I can accept it
Comments.UserDisplayName: MoritzLost
Tags: <ffmpeg>
Title: Mux mkv and dts file, change default audio stream and language
UserDisplayName: MoritzLost
ThreadText: # Mux mkv and dts file, change default audio stream and language
  
  (Asked by: username_0 on 2016-10-22)
  
  I want to mux (combine) two files into one `mkv` file. The first one is an `mkv` file that contains a video and an audio stream in German. The second one is an English audio stream in `dts` format.I want one `mkv` file that contains both audio channels, the English one being the first and default audio stream.
  
  Here's the ffmpeg command I'm using so far:
  
  ```
  ffmpeg -i movie.mkv -i audio.dts -map 0:v:0 -map 1:a:0
  -map 0:a:0 -c copy movie_combined.mkv
  
  ```
  
  This produces acceptable results. I get an `mkv` file that has two audio channels, the first one English, the second one German. However, there's two problems. The second (German) audio stream is still the default stream (VLC media player uses it by default and according to MediaInfo, there's a default flag on the stream). Also, the English stream doesn't show up as English, according to MediaInfo there's no language information for that stream.
  
  How do I flag the English audio stream as the default one? And how do I add the language information for that stream (so that, for example, it shows up as English in the audio track selection of VLC media player)?
  
  **Tags:** ffmpeg
  
  > **Comments:**
  > **username_1**: For language, add `-metadata:s:a:0 language=eng`. FFmpeg doesn't set or alter track dispositions in MKV. Use [mkvpropedit](https://mkvtoolnix.download/doc/mkvpropedit.html).  
  > **username_0**: @Mulvya Thanks, the metadata tag works. Can you explain what it does / how that parameter takes it's input? And do you know what command I need to use with mkvpropedit to set the default audio stream flag? Feel free to post that as an answer so I can accept it  
  
  ---
  
  ## 2 answers
  
  ### Answer by username_1 on 2016-10-24. Score: 4 | Accepted answer
  
  For language, add `-metadata:s:a:0 language=eng`.
  
  FFmpeg doesn't set or alter track dispositions in MKV. Use [mkvpropedit](https://mkvtoolnix.download/doc/mkvpropedit.html).
  
  To set the default flag for the first audio track and remove it from the second one, use this command:
  
  ```
  mkvpropedit movie.mkv --edit track:a1 --set flag-default=1 --edit track:a2 --set flag-default=0
  
  ```
  
  As mentioned in the docs, the app "*does not set the 'default track flag' of other tracks to '0' if it is set to '1' for a different track automatically.*" This is salient because FFmpeg sets default flags for all tracks to `1` unless the input has it different.
  
  
  ---
  
  ### Answer by username_2 on 2017-05-09. Score: 10
  
  Based on [this answer on stackoverflow](https://stackoverflow.com/questions/26956762/ffmpeg-set-subtitles-track-as-default/35235287#35235287), it seems that changing the disposition is now possible with ffmpeg (see also [the official documentation](https://ffmpeg.org/ffmpeg.html)).
  
  I think that the command that you would need, so that the final file had English as the default audio stream is:
  
  ```
  ffmpeg -i movie.mkv -i audio.dts -map 0:v:0 -map 1:a:0 -map 0:a:0 -c copy -disposition:a:0 default -disposition:a:1 0 movie_combined.mkv
  
  ```
  
  The addition is `-disposition:a:0 default -disposition:a:1 0`. The numbering of the streams is for the output. `-disposition:a:1 0` is needed to remove the disposition from the second stream.
  
  (Instead of `-disposition:a:1 0` you could also, in principle, use the non-documented `-disposition:a:1 none`, which has the same effect.)
  
  To add metadata/language information, see the [other answer](https://video.stackexchange.com/a/19644/18877).
  
  > **Comments:**
  > **username_1**: Have you tested this? At the time of my answer, `-disposition` was added but didn't work with MKVs.  
  > **username_2**: Yes, I have tested this (using ffmpeg on Ubuntu 16.04) with MKVs and it did work. The changed disposition was recognised by both ffmpeg itself (`ffmpeg -i previous_output_file.mkv`) and a mediaplayer.  
  > **username_3**: for people stumbling over this (like me): the [ffmpeg doc](https://ffmpeg.org/ffmpeg.html) now has `-disposition` and says, that you should use `0`to delete the disposition. `none` is not listed there, maybe unknown values are simply mapped to `0`.  
  > **username_2**: Thanks for the information! It's great that `-disposition` is now documented. `none`, despite indeed not being mentioned there, still seems to work. It's not just the case that unknown values are mapped to `0` — using any other value results in an error message. I've edited the answer, but kept mention of `none` in case there are old versions of `ffmpeg` which accept `none` but not `0`. (It's unlikely, but I don't want to test all old versions or trawl the git history...)  
  
  ---
  
  