serede / mkvtoolnix-batch Goto Github PK
View Code? Open in Web Editor NEWWindows Batch script to automate batch processing using mkvtoolnix.
License: GNU General Public License v3.0
Windows Batch script to automate batch processing using mkvtoolnix.
License: GNU General Public License v3.0
This code is a life and time saver, thank you for going through the time to make this for everyone
My input files have 2 audio tracks and 2 subtitle tracks. The audio tracks are Japanese and English in that order, the subtitles are English Signs/Songs and English Full in that order. My output files will have 4 audio and subtitle tracks. Japanese, English, Japanese, English. The subtitles would be Signs/Songs, Full, Signs/Songs, Full.
I'm not sure what could be happening here, MKVToolNix GUI output doesn't have this same issue. I'll attach my json file below. Anything helps. Thanks!
[
"--ui-language",
"en",
"--track-name",
"0:HEVC x265 10b",
"--default-track",
"0:yes",
"--display-dimensions",
"0:1440x1080",
"--language",
"1:ja",
"--track-name",
"1:Japanese",
"--language",
"2:en",
"--track-name",
"2:English",
"--default-track",
"2:yes",
"--language",
"3:en",
"--track-name",
"3:English [Signs/Songs]",
"--default-track",
"3:yes",
"--forced-track",
"3:yes",
"--language",
"4:en",
"--track-name",
"4:English [Full]",
"(",
"E:\Videos\TV\Bleach\Disk 1\Bleach - 001.mkv",
")",
"--track-order",
"0:0,0:1,0:2,0:3,0:4"
]
Edit: After running this command, it also comes up with "Warning: 'Bleach - 001.mkv': Could not keep a track's UID 'X' because it is already allocated for another track. A new random UID will be allocated automatically" for every track. X being numbered 1-5 for every track on file. I'm almost certain it isn't an issue with this batch file, but still anything helps. Thanks
e.g have it merge "Breaking Bad S01E01.mkv & Breaking Bad S01E01.srt" and "Breaking Bad S01E02.mkv & Breaking Bad S01E02.srt" in the same folder to two different files
Hi,
I wanted to batch multiplex mkv files with subtitle files in srt format. I have 2 subtible files for each mkv file. I followed your tutorial step by step. The batch script was executed without any issues but my output files were created without any subtitle track... Can you please advice on that?
Thank you
SpikeFly
Not sure what happened.
I've tried to do this twice now, and both times, the files spat out at the end simply aren't having the subtitles muxed into the video. If i manually add the subtitle tracks, or mux them individually, it works fine. anybody know what I'm missing? i'm following the guide to the letter but it just isn't working. The video files are .mkv files btw.
hello, thank you so much for making this program! please add an option to edit the folder path without opening the selector window...
This only works if you A) have those parameters in your options file, and B) if the file you're trying to batch is MKV already. If you want to batch an entire directory from say, .ts to .mkv. This simply doesn't do that.
This would actually work better:
for %%A IN (*.ts) do ( D:\path\to\MKVToolNix\mkvmerge.exe -o ".\out\%%~nA.mkv" "%%~A") pause
Inside a batch (.bat) file and put into the directory you're converting the files to. *.ts can be any video format mkvmerge accepts, i.e. *.mp4 - then baddaboom-badda-bing, all your new mkv's are in the out directory.
I love this script.
I have a question. Everything works if all variables are in the same file. If I had to add for example an audio or a subtitles from another file, what should I put?
Thank you.
Fabrizio
Hi, i've got a folder with a season of a tv series. It contains 9 episodes and 9 .srt files.
I've modified the script at line 9:
From this:
for %%f in (*.mkv) do %mkvmerge% @options.json -o "mkvmerge_out/%%f" "%%f"
To this:
for %%f in (*.mp4) do %mkvmerge% @options.json -o "mkvmerge_out/%%f.mkv" "%%f"
So the batch grabs the mp4 files and outputs mkv files with subs.
It can mux all episodes but the problem is that it uses only the subtitles i've used to generate the option.json. If i use subtitles of episode 1 it puts at every episode those subs.
This is most likely not a bug bot my stupidity and code illiteracy, but I get the following error when I try to run the script as per instruction.
`Error: The JSON option file 'options.json' contains an error: [json.exception.parse_error.101] parse error at line 1, column 18: syntax error while parsing value - unexpected ','; expected end of input.
Error: The JSON option file 'options.json' contains an error: [json.exception.parse_error.101] parse error at line 1, column 18: syntax error while parsing value - unexpected ','; expected end of input.
Error: The JSON option file 'options.json' contains an error: [json.exception.parse_error.101] parse error at line 1, column 18: syntax error while parsing value - unexpected ','; expected end of input.
Error: The JSON option file 'options.json' contains an error: [json.exception.parse_error.101] parse error at line 1, column 18: syntax error while parsing value - unexpected ','; expected end of input.
Error: The JSON option file 'options.json' contains an error: [json.exception.parse_error.101] parse error at line 1, column 18: syntax error while parsing value - unexpected ','; expected end of input.
Error: The JSON option file 'options.json' contains an error: [json.exception.parse_error.101] parse error at line 1, column 18: syntax error while parsing value - unexpected ','; expected end of input.
Error: The JSON option file 'options.json' contains an error: [json.exception.parse_error.101] parse error at line 1, column 18: syntax error while parsing value - unexpected ','; expected end of input.
Error: The JSON option file 'options.json' contains an error: [json.exception.parse_error.101] parse error at line 1, column 18: syntax error while parsing value - unexpected ','; expected end of input.
Error: The JSON option file 'options.json' contains an error: [json.exception.parse_error.101] parse error at line 1, column 18: syntax error while parsing value - unexpected ','; expected end of input.
Error: The JSON option file 'options.json' contains an error: [json.exception.parse_error.101] parse error at line 1, column 18: syntax error while parsing value - unexpected ','; expected end of input.
Error: The JSON option file 'options.json' contains an error: [json.exception.parse_error.101] parse error at line 1, column 18: syntax error while parsing value - unexpected ','; expected end of input.
Error: The JSON option file 'options.json' contains an error: [json.exception.parse_error.101] parse error at line 1, column 18: syntax error while parsing value - unexpected ','; expected end of input.
Error: The JSON option file 'options.json' contains an error: [json.exception.parse_error.101] parse error at line 1, column 18: syntax error while parsing value - unexpected ','; expected end of input.
Error: The JSON option file 'options.json' contains an error: [json.exception.parse_error.101] parse error at line 1, column 18: syntax error while parsing value - unexpected ','; expected end of input.
Error: The JSON option file 'options.json' contains an error: [json.exception.parse_error.101] parse error at line 1, column 18: syntax error while parsing value - unexpected ','; expected end of input.
Error: The JSON option file 'options.json' contains an error: [json.exception.parse_error.101] parse error at line 1, column 18: syntax error while parsing value - unexpected ','; expected end of input.
Error: The JSON option file 'options.json' contains an error: [json.exception.parse_error.101] parse error at line 1, column 18: syntax error while parsing value - unexpected ','; expected end of input.
Error: The JSON option file 'options.json' contains an error: [json.exception.parse_error.101] parse error at line 1, column 18: syntax error while parsing value - unexpected ','; expected end of input.
Error: The JSON option file 'options.json' contains an error: [json.exception.parse_error.101] parse error at line 1, column 18: syntax error while parsing value - unexpected ','; expected end of input.
============================
Done. Press any key to exit.`
My options.json looks like this:
"--ui-language", "en", "--language", "0:eng", "--track-name", "0:Eng Dub", "--language", "0:eng", "--language", "0:und", "--track-name", "0:AAC 5.1", "--language", "0:und", "--track-name", "0:Lyrics/Songs", "--no-subtitles", "--language", "0:und", "--track-name", "0:", "--default-track", "0:yes", "--language", "1:jpn", "--track-name", "1:Flac 2.0", "--language", "0:ger", "--track-name", "0:Ger Dub", "--sync", "0:600", "--track-order", "4:0,2:0,4:1,0:0,5:0,1:0,3:0"
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?
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.