I am trying to create a batch script that will strip a specific audio track from multiple video files using "ffmpeg".

The audio track has the same ID on all files. after performing "ffmpeg -i file.mkv I get: enter image description here

What I want to do is strip the DTS-HD MA audio track. So I created a batch script:

if not exist muxed md muxed
for %%g in (*.mkv) do (
    ffmpeg -i %%g -map 0:1 -c copy muxed\%%g

But unfortunately what it does is it strips video track and second audio track (DDP 5.1)

I have tried other ID combos also:

  • 0:0 - Strips both audio tracks
  • 0:1 - Strips video track and second audio track (DDP 5.1)
  • 0:2 - Strips video track and first audio track (DTS-HD MA)

I simply want it to strip the DTS-HD MA track. the closest I came was with 0:2 but that also removed the video track.

What am I doing wrong?


Nevermind, I figured it out on my own.


if not exist DDP md DDP
for %%g in (*.mkv) do (
  ffmpeg -i %%g -map 0:0 -map 0:2 -c copy DDP\%%g

This will leave out the audio track with ID 0: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.