Search code examples
ffmpegaac

Map different streams in FFmpeg, is this identical? And working?


I use FFmpeg on Windows 10 (command line). I want to reencode a video with:

  1. Video stream -> x265 CRF 20
  2. Audio stream 1 -> AAC stereo 128k
  3. Audio stream 2 -> AAC stereo 96k
  4. Subtitle 1 -> copy
  5. Subtitle 2 -> copy
  6. Subtitle 3 -> drop

I am only wondering if these three lines of code gives the same result. And if the three of them are working? ^^

ffmpeg -i input.mkv
-map 0 -map -0:s:2
-c:v libx265 -crf 20
-c:a:0 aac -b:a:0 128k
-c:a:1 aac -b:a:1 96k
-c:s copy
output.mkv
ffmpeg -i input.mkv
-map 0 -map -0:s:2
-c copy
-c:v libx265 -crf 20
-c:a:0 aac -b:a:0 128k
-c:a:1 aac -b:a:1 96k
output.mkv
ffmpeg -i input.mkv
-map 0:0 -map 0:1 -map 0:2 -map 0:3 -map 0:4
-c:v libx265 -crf 20
-c:a:0 aac -b:a:0 128k
-c:a:1 aac -b:a:1 96k
-c:s copy
output.mkv

The first one is running, but I have to wait a day at least before knowing the result. ;)

Thanks!


Solution

  • The first two commands are equivalent. So, is the third one, if the streams are in the order listed in your question.

    The audio output will be stereo only if the input is stereo. Add -ac 2 otherwise.