user34556: 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!

user35763: 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

34556: <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>
 35763: <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>
