Open kenichi512 opened 6 years ago
Hi @kenichi512 !
The track multiplexing functionality that is coded in the JSON file belongs to the MKVToolNix project. The main limitation is that the exported options are not file-wise parameterizable, that's why here one must remove the --output
setting from the JSON and use -o "mkvmerge_out/%%f"
inside the FOR loop of the script (%%f
is each original filename). Otherwise, a single output file would be overwritten one time after another for each input file, and only that of the last multiplexed file would remain when the script finishes.
What you are proposing requires a similar workaround: Let %%f
be the name of each input MKV file, you could place the respective subtitles as subs/%%f.ass
files (for example) and tell mkvmerge
to include one each as a subtitle track via additional arguments in the BAT file. You can try manually adding the subtitle track in the GUI and exporting the options JSON file to get an idea of how the command should look like.
Feel free to experiment and submit a pull request when you get it done!
I clarify that my knowledge in DOS are very few, but someone helped me a long time ago with this CLI for the same purpose.
@echo off set "mkvmerge=drive\path\mkvmerge\mkvmerge.exe" FOR %%I in (drive\path\*.MP4) DO "%mkvmerge%" --output "drive\path\output\%%~nI.mkv" --language 0:jpn --track-name 1:"日本語" --language 1:jpn ( "%%I" ) --sub-charset 0:UTF-8 --language 0:spa --track-name 0:"Español (México)" ( "drive\path\input\%%~nI.esLA.ass" ) --sub-charset 0:UTF-8 --language 0:eng ( "drive\path\input\%%~nI.enUS.ass" ) --sub-charset 0:UTF-8 --language 0:por --track-name 0:"Português (Brasil)" ( "drive\path\input\%%~nI.ptBR.ass" ) --track-order 0:0,0:1,1:0,2:0,3:0 PAUSE
However, this has a disadvantage and is the interpretation of code page (the tags on "--track-name"). Although I save the batch file as UTF-8, the metadata of the multiplexed video appear with other symbols. I do not understand how in MKVToolnix these errors do not happen.
See possible workaround by @Rice14 in #6.
This works to change the internal tracks files from from one container to other. But what happens if I want to add external files like subtitles and audios of several languages? What should be added to the JSON file to continue with the loop conversion?