Home » Questions » Computers [ Ask a new question ]

How to strip audio streams from an MKV file?

How to strip audio streams from an MKV file?

I've been trying to remove unneeded audio streams from an MKV (Matroska) file. The reason why I want to do this is to avoid having to manually select the wanted stream in Windows Media Player.

Asked by: Guest | Views: 291
Total answers/comments: 2
Guest [Entry]

"If all you want to do is remove a stream, not re-encode, you probably want to do this with the MKVtoolnix package (see videohelp.com's page).
There are a couple of GUIs that may help you (check around on the videohelp link). I'm not sure what the exact mkvmerge commandline might be, but I think something like this would work:
# first, get audio track info so we know which one to keep
mkvmerge -i input.mkv
File 'input.mkv': container: Matroska
Track ID 1: video (V_MPEG4/ISO/AVC)
Track ID 2: audio (A_AAC)
Track ID 3: audio (A_AAC) <----------- for example, let's keep this one
Track ID 4: audio (A_AAC)

mkvmerge -o output.mkv --audio-tracks 3 input.mkv

That should do the trick (I don't have a file handy for testing, sorry). The --audio-tracks option tells mkvmerge to copy only the listed audio tracks to the new file. If you wanted to keep 2 & 3 but not 4, you could use --audio-tracks 2,3.
mkvmerge has a lot of other options for setting titles, adding a delay to sync audio, etc, so check the manpage for details."
Guest [Entry]

"There are really two separate issues here:

In the first command line, the order of parameters may be wrong. I think the -newaudio switch needs to be at the end, after the output file name.
The second command line, ""Removing the subtitles"", since the input file has subtitles, you need to use the -sn switch to remove them. Otherwise, it seems FFmpeg wants at least one specified in the -map list."