Answers.Body: <p>Why don't map everything</p>
  <pre><code>ffmpeg -i input.mkv -i input.aac -i input.srt -map 0:0 -map 0:a:0 -map 2:0 -map 1:a -c copy output.mkv
  </code></pre>
  <p>But it is unclear which one to map, you took different stream each time from the mkv <code>-map 0:0 -map 0:1 -map 0:2</code> vs <code>-map 0:v -map 0:a:0</code></p>
  
Answers.ContentLicense: CC BY-SA 4.0
Answers.CreationDate: 2021-08-05T05:51:02.297Z
Answers.LastActivityDate: 2021-08-05T05:51:02.297Z
Answers.UserDisplayName: Abdullah Ibn Fulan
Body: <p>Add audio and subtitle in mkv video by one command.</p>
  <p>Code add subtitle:</p>
  <pre><code>-i input.mkv -f srt -i subtitle.srt -map 0:0 -map 0:1 -map 0:2 -map 1:0 -c:v copy -c:a copy -c:s srt -c:s:0 srt -metadata:s:s:0 language=eng output.mkv
  </code></pre>
  <p>Code add audio:</p>
  <pre><code>-i input.mkv -i audio.aac -map 0:v -map 0:a:0 -map 1:a -metadata:s:a:1 language=eng  -codec copy output.mkv
  </code></pre>
  <p>I couldn't add subtitle and audio in one command.Please help me!</p>
  
Tags: <ffmpeg>
Title: Add audio and subtitle in mkv video by one command
UserDisplayName: Q_T
ThreadText: # Add audio and subtitle in mkv video by one command
  
  (Asked by: username_0 on 2021-04-12)
  
  Add audio and subtitle in mkv video by one command.
  
  Code add subtitle:
  
  ```
  -i input.mkv -f srt -i subtitle.srt -map 0:0 -map 0:1 -map 0:2 -map 1:0 -c:v copy -c:a copy -c:s srt -c:s:0 srt -metadata:s:s:0 language=eng output.mkv
  
  ```
  
  Code add audio:
  
  ```
  -i input.mkv -i audio.aac -map 0:v -map 0:a:0 -map 1:a -metadata:s:a:1 language=eng  -codec copy output.mkv
  
  ```
  
  I couldn't add subtitle and audio in one command.Please help me!
  
  **Tags:** ffmpeg
  
  
  ---
  
  ## 1 answers
  
  ### Answer by username_1 on 2021-08-05. Score: 1
  
  Why don't map everything
  
  ```
  ffmpeg -i input.mkv -i input.aac -i input.srt -map 0:0 -map 0:a:0 -map 2:0 -map 1:a -c copy output.mkv
  
  ```
  
  But it is unclear which one to map, you took different stream each time from the mkv `-map 0:0 -map 0:1 -map 0:2` vs `-map 0:v -map 0:a:0`
  
  
  ---
  
  