Struggling for some time in that problem. I have a list of videos going this way, by pairs :
magic.mkv magic-1.mkv
food.mkv food-2.mkv
wedding.mkv wedding-3.mkv
etc.
Each video has its pair, and the pair has a number that is incrementing every time. I want to mux each pair together. And for each pair : First video (without the numbers) keep everything except for chapters, Second video (with the incrementing number) to keep all subtitles only.
Now I know how to select tracks and so on, what I don't know, is how to make this .bat file mux those pairs, whiches are all in the same folder. (I know I could put each pair in a different folder, but I have more than 700 files so first I would like to see if there is a way to do this with code)
Opened to any suggestion (I'm not very tech saavy please be specific).
Thank you in advance.
Tried that, and it crashed ("error the file cannont be opened for reading" - open file error
) :
for %%a & for %%a-1 in (*.mkv) do "\\\\\\MKV Tool Nix\mkvtoolnix\mkvmerge.exe" -o "tada\%%~a" --default-track "5:yes" --track-order 1:0,1:1,1:2,1:3,0:4,0:5,0:6,0:7,0:8,0:9,0:10 "%%~a"
Tried that, and it crashed ("error the file cannont be opened for reading" - open file error
) :
for %%a in (*.mkv) do "C:\\MKV Tool Nix\mkvtoolnix\mkvmerge.exe" -o "tada\%%~a" '(' %%~na-1%%~xa ')' --default-track "5:yes" --track-order 1:0,1:1,1:2,1:3,0:4,0:5,0:6,0:7,0:8,0:9,0:10 "%%~a"
Tried that, and it does not crash, but it looks for the second video like that : videoone.mkv-1
, as opposed to videoone-1.mkv
. It means that %%a
will look for the full name including the specified extension, so probably %%a
is not the right thing to use since I need to specify a file name, then the extension :
for %%a in (*.mkv) do "C:\\MKV Tool Nix\mkvtoolnix\mkvmerge.exe" -o "tada\%%~a" '(' %%a %%a-1 ')' --default-track "5:yes" --track-order 1:0,1:1,1:2,1:3,0:4,0:5,0:6,0:7,0:8,0:9,0:10 "%%~a"
Does the following example script help you out?
All you should need to do, if it works for you, is change the
Echo
command line to your particularmkvmerge.exe
command line, remembering that"%%~I%%~xG"
is the non suffixed filename and"%%G"
is the suffixed one.Depending upon the makeup of your specific filenames you may wish to change:
to:
If your filenames are even more complex, you may be better advised to change to outer
For
loop to aFor /F
loop using theDir
command piped tofindstr.exe
filtering using something like/IR "\-[123456789][0123456789]*\.mkv$"
.