
The mkvmerge… multiplexes all the files in the current directory (that's what *(.) means in zsh) to a file whose name is the same as the sub-directory but with. The cd $SUBDIR changes into that sub-directory. The for line iterates over all sub-directories in the current directory & assigns the name of that sub-directory to the variable SUBDIR. I know this will most likely not help you, but just as a hint of how easy it can be with the proper tool (in this case: a shell such as zsh): for SUBDIR in *(/) do

Then e01.mkv would be created in the merge directory. So as an example you would need e01.mkv in the current directory, video\e01.mkv, engaudio\e01.mkv, jpnaudio\e01.mkv and engsub\e01.mkv. Note that this requires everything to have the same name in each directory and that the original files were in the current directory (but nothing is taken from them). Merge video, eng audio, jpn audio and eng subs all from separate files in their own directory together into new merge directory (setting some defaults): md mergeįor %%a in ("*.mkv") do "C:/Program Files/MKVToolNix\mkvmerge.exe" -output "merge\%%a" -default-track 0:yes "video\%%a" -default-track 0:yes -forced-track 0:no "engaudio\%%a" -forced-track 0:no "jpnaudio\%%a" -default-track 0:no -forced-track 0:no "engsub\%%a" Split off the eng subs from each video in current directory in an engsub directory: md engsubįor %%a in ("*.mkv") do "C:/Program Files/MKVToolNix\mkvmerge.exe" -output "engsub\%%a" -subtitle-tracks eng -no-video -no-audio -no-chapters -no-global-tags "%%a" Split off the eng audio from each video in current directory into an engaudio directory: md engaudioįor %%a in ("*.mkv") do "C:/Program Files/MKVToolNix\mkvmerge.exe" -output "engaudio\%%a" -audio-tracks eng -no-video -no-subtitles -no-chapters -no-global-tags "%%a" Here are a few examples I've used recently that may help get you started (batch files).

You'll need to spend a bit of time learning a product to automate your calls to mkvmerge (batch file, power shell, python, etc). There are any number of ways to do something like you're saying using the command line. Your question is more about automation rather than anything to do with mkvmerge specifically.
