Welcome to Doom9's Forum, THE in-place to be for everyone interested in DVD conversion. Before you start posting please read the forum rules. By posting to this forum you agree to abide by the rules. |
26th August 2014, 05:13 | #1 | Link |
Registered User
Join Date: Mar 2011
Posts: 5
|
batch remux with Mkvmerge
hello, I hope somebody can help me. Currently I have about 70 mkvs. 25 of them I remuxed already. that leaves me with the rest of the videos to remux.
this is the process I did > open Mkvmerge> add .mkv file> uncheck current sub(s)> add edited .srt (name: ...track02)> change language of that srt to "english">highlight edited .srt and click "up" to move it above chapter track> add to queue or start muxing. before this process. I removed all subs using Mkvextract then check & correct any errors. I was reading here and found that you can use batch file to automate this process. Unfortunately I have no clue on how to make a batch file. thank you |
26th August 2014, 08:01 | #2 | Link |
Registered User
Join Date: Nov 2001
Posts: 1,104
|
if exist *.mkv mkdir m:\remux for %%a in (*.mkv) do ("D:\Programme\MKVtoolnix\mkvmerge.exe" -S -o "m:\remux\%%a" "--language" "0:eng" "--default-track" "0:no" "--forced-track" "0:no" "--display-dimensions" "0:1280x720" "--language" "1:eng" "--default-track" "1:yes" "--forced-track" "1:no" "-a" "1" "-d" "0" "-S" "-T" "--no-global-tags" "--no-chapters" "(" "%%a" ")" "--language" "0:eng" "--default-track" "0:no" "--forced-track" "0:no" "-s" "0" "-D" "-A" "-T" "--no-global-tags" "--no-chapters" "(" "%%~na.srt" ")" "--track-order" "0:0,0:1,1:0" "--title" "" "--engage" "no_cue_duration" "--engage" "no_cue_relative_position" "--disable-track-statistics-tags" ) If you pasted everything right, you'll see mkvmerge start. If not, you can read the error message.
__________________
MultiMakeMKV: MakeMKV batch processing (Win) MultiShrink: DVD Shrink batch processing Offizieller Übersetzer von DVD Shrink deutsch Last edited by Chetwood; 26th August 2014 at 08:17. |
26th August 2014, 10:44 | #3 | Link |
Registered User
Join Date: Mar 2011
Posts: 5
|
I think I lost you in the last steps.
This is the result after following your instructions. if exist *.mkv mkdir m:\remux for %%a in (*.mkv) do ("C:\Program Files (x86)\MKVToolNix\mkvmerge.exe" -S -o "m:\remux\%%a" "--language" "0:eng" "--default-track" "0:yes" "--forced-track" "0:no" "--display-dimensions" "0:984x720" "--language" "1:eng" "--default-track" "1:yes" "--forced-track" "1:no" "-a" "1" "-d" "0" "-S" "-T" "--no-global-tags" "(" "%%a" ")" "--language" "0:eng" "--forced-track" "0:no" "-s" "0" "-D" "-A" "-T" "--no-global-tags" "--no-chapters" "(" "%%~na.srt" ")" "--track-order" "0:0,0:1,1:0" ) Below is the original lines that I copied from mkvmerge. "C:\Program Files (x86)\MKVToolNix\mkvmerge.exe" -o "C:\\Users\\Mark\\Desktop\\Movies\\The Mummy (1932) 720p\\The Mummy (1932) 720p (1).mkv" "--language" "0:eng" "--default-track" "0:yes" "--forced-track" "0:no" "--display-dimensions" "0:984x720" "--language" "1:eng" "--default-track" "1:yes" "--forced-track" "1:no" "-a" "1" "-d" "0" "-S" "-T" "--no-global-tags" "(" "C:\\Users\\Mark\\Desktop\\Movies\\The Mummy (1932) 720p\\The Mummy (1932) 720p.mkv" ")" "--language" "0:eng" "--forced-track" "0:no" "-s" "0" "-D" "-A" "-T" "--no-global-tags" "--no-chapters" "(" "C:\\Users\\Mark\\Desktop\\Movies\\The Mummy (1932) 720p\\The Mummy (1932) 720p_Track02.srt" ")" "--track-order" "0:0,0:1,1:0" Questions: 1. You said "%%~na.srt" <- the srt you want to add (should be in the folder with the mkvs having the same name) My subs don't have the same name with the movies but they are on the same location. However, all of them have "track02" at the end (ex.The Mummy (1932) 720p_Track02). Is there any way to do it with that name? 2. "open a command window in the source dir" > Im not really sure how to do this. Im using windows 8. are you referring to command prompt? 3. You also mention that "the remuxed files will be written to "\m:remux" > will this be the same as the directory of the orginal .mkv file? Please excuse my ignorance. I'm totally noob with regards to codes & technical terms. I appreciate you helping me. |
26th August 2014, 13:32 | #4 | Link |
Registered User
Join Date: Nov 2001
Posts: 1,104
|
1. Should look like this
The Mummy (1932) 720p.mkv The Mummy (1932) 720p.srt If it's The Mummy (1932) 720p.mkv The Mummy (1932) 720p_Track02.srt the batch entry would have to read "%%~na_Track02.srt" The base name has to be identical, otherwise the batch wouldn't mux the corresponding srt to the right mkv. 2. Yes. It's called command prompt here or something. 3. Nope, otherwise you would overwrite the old file and the batch would abort cause it does not add the (1) to the file name. Simply have all mkvs and srts in one dir and use any other dir as the target directory, in my case m:\remux (which usually is on another hdd so the process is faster). Also, make sure the for %%a starts on a new line in the batch.
__________________
MultiMakeMKV: MakeMKV batch processing (Win) MultiShrink: DVD Shrink batch processing Offizieller Übersetzer von DVD Shrink deutsch |
26th August 2014, 21:30 | #5 | Link |
Registered User
Join Date: Mar 2011
Posts: 5
|
Still having trouble. I cant figured out how to do this "open a command window in the source dir". The only way I know to open cmd is to go to start>run>type "CMD">enter. So, I just double-click on the batch file that I made. command prompt opens but not mkvmerge & here is the error message in cmd.
I:\TEST\Movies>if exist *.mkv mkdir I:\Test\Movies A subdirectory or file I:\Test\Movies already exists. I:\TEST\Movies>for %a in (*.mkv) do ("C:\Program Files (x86)\MKVToolNix\mkvmerge .exe" -S -o "I:\Remuxed movies\%a" "--language" "0:eng" "--default-track" "0:no" "--forced-track" "0:no" "--display-dimensions" "0:1280x720" "--language" "1:eng " "--default-track" "1:yes" "--forced-track" "1:no" "-a" "1" "-d" "0" "-S" "-T" "--no-global-tags" "--no-chapters" "(" "%a" ")" "--language" "0:eng" "--default- track" "0:no" "--forced-track" "0:no" "-s" "0" "-D" "-A" "-T" "--no-global-tags" "--no-chapters" "(" "%~na_Track02.srt" ")" "--track-order" "0:0,0:1,1:0" "--tit le" "" "--engage" "no_cue_duration" "--engage" "no_cue_relative_position" "--dis able-track-statistics-tags" ) I:\TEST\Movies>("C:\Program Files (x86)\MKVToolNix\mkvmerge.exe" -S -o "I:\Remux ed movies\The Man with the Golden Gun (1974) 720p.mkv" "--language" "0:eng" "--d efault-track" "0:no" "--forced-track" "0:no" "--display-dimensions" "0:1280x720" "--language" "1:eng" "--default-track" "1:yes" "--forced-track" "1:no" "-a" "1" "-d" "0" "-S" "-T" "--no-global-tags" "--no-chapters" "(" "The Man with the Gol den Gun (1974) 720p.mkv" ")" "--language" "0:eng" "--default-track" "0:no" "--fo rced-track" "0:no" "-s" "0" "-D" "-A" "-T" "--no-global-tags" "--no-chapters" "( " "The Man with the Golden Gun (1974) 720p_Track02.srt" ")" "--track-order" "0:0 ,0:1,1:0" "--title" "" "--engage" "no_cue_duration" "--engage" "no_cue_relative_ position" "--disable-track-statistics-tags" ) mkvmerge v7.1.0 ('Good Love') 64bit built on Jul 27 2014 13:06:55 'The Man with the Golden Gun (1974) 720p.mkv': Using the demultiplexer for the f ormat 'Matroska'. 'The Man with the Golden Gun (1974) 720p_Track02.srt': Using the demultiplexer f or the format 'SRT subtitles'. 'The Man with the Golden Gun (1974) 720p.mkv' track 0: Using the output module f or the format 'AVC/h.264'. 'The Man with the Golden Gun (1974) 720p.mkv' track 1: Using the output module f or the format 'AC3'. 'The Man with the Golden Gun (1974) 720p_Track02.srt' track 0: Using the output module for the format 'text subtitles'. The file 'I:\Remuxed movies\The Man with the Golden Gun (1974) 720p.mkv' has bee n opened for writing. The Man with the Golden Gun (1974) 720p.mkv: Error in the Matroska file structur e at position 3114853559. Resyncing to the next level 1 element. The last timecode processed before the error was encountered was 02:05:11.072000 000. Resync failed: no valid Matroska level 1 element found. Progress: 100% The cue entries (the index) are being written... Muxing took 31 seconds. Just wanna clarify some things. if exist *.mkv mkdir m:\remux for %%a in (*.mkv) do > the "m:\remux" is the path where my mkv's and srt's? 1.Lets say I have my movies on Drive I>TEST>Movies then I should enter "I:\TEST\Movies" ? & "m:\remux\%%a" <- the remuxed files will be written to m:\remux 2. Is this my target folder? I put "I:\remuxed movies\%%a" ? I'm I missing something? if exist *.mkv mkdir I:\TEST\Movies for %%a in (*.mkv) do ("C:\Program Files (x86)\MKVToolNix\mkvmerge.exe" -S -o "I:\Remuxed movies\%%a" "--language" "0:eng" "--default-track" "0:no" "--forced-track" "0:no" "--display-dimensions" "0:1280x720" "--language" "1:eng" "--default-track" "1:yes" "--forced-track" "1:no" "-a" "1" "-d" "0" "-S" "-T" "--no-global-tags" "--no-chapters" "(" "%%a" ")" "--language" "0:eng" "--default-track" "0:no" "--forced-track" "0:no" "-s" "0" "-D" "-A" "-T" "--no-global-tags" "--no-chapters" "(" "%%~na_Track02.srt" ")" "--track-order" "0:0,0:1,1:0" "--title" "" "--engage" "no_cue_duration" "--engage" "no_cue_relative_position" "--disable-track-statistics-tags" ) ***EDIT*** I tried manually using mkvmerge without .bat to remux the file & I got the same result. The problem is there was no muxed mkv when I used the batch. Below is the output in mkvmerge. mkvmerge v7.1.0 ('Good Love') 64bit built on Jul 27 2014 13:06:55 'I:\TEST\Movies\The Man with the Golden Gun (1974) 720p.mkv': Using the demultiplexer for the format 'Matroska'. 'I:\TEST\Movies\The Man with the Golden Gun (1974) 720p_Track02.srt': Using the demultiplexer for the format 'SRT subtitles'. 'I:\TEST\Movies\The Man with the Golden Gun (1974) 720p.mkv' track 0: Using the output module for the format 'AVC/h.264'. 'I:\TEST\Movies\The Man with the Golden Gun (1974) 720p.mkv' track 1: Using the output module for the format 'AC3'. 'I:\TEST\Movies\The Man with the Golden Gun (1974) 720p_Track02.srt' track 0: Using the output module for the format 'text subtitles'. The file 'I:\TEST\Movies\The Man with the Golden Gun (1974) 720p (1).mkv' has been opened for writing. I:\TEST\Movies\The Man with the Golden Gun (1974) 720p.mkv: Error in the Matroska file structure at position 3114853559. Resyncing to the next level 1 element. The last timecode processed before the error was encountered was 02:05:11.072000000. Resync failed: no valid Matroska level 1 element found. The cue entries (the index) are being written... Muxing took 43 seconds. Last edited by Chakabear13; 26th August 2014 at 22:14. Reason: addendum |
26th August 2014, 22:49 | #7 | Link |
Registered User
Join Date: Mar 2011
Posts: 5
|
Finally GOT it! I was looking at the wrong folder.
A few hiccups though. 1. After remuxed "Chapter" tracks are gone. How can I keep the chapter track and only remove current subtitle(s)? 2. New subtitle file is not labeled "Default or Yes" in Default Track Flag. 3. Is there any way to tell if there is really an error muxing the files with this process? I'm not very familiar looking at cmd so if I remuxed 50+ mkvs I wont be able to tell easily w/c one has error that needs to be fixed. (When I remuxed my first 25 mkvs. I got errors on some of them in mkvmerge). 4. If my mkv file has foreign audio will this batch change it to english? Last edited by Chakabear13; 26th August 2014 at 23:06. |
27th August 2014, 08:00 | #8 | Link | |
Registered User
Join Date: Nov 2001
Posts: 1,104
|
Probably because you used I:\TEST\Movies and I:\Remuxed movies\. The first line of the batch creates the target directory. It only does it so Mkvmerge does not abort when the dir is not present. Thus, it must be the same dir.
Quote:
Since we're talking batches here, the composition of the files needs to be identical! You cannot have one mkv where the subtitle is set to default yes and another where the subtitle is set to default no. Dunno why mmg copied this over but if you browse the command carefully, you'll notice "--no-chapters". Remove this and the chapters are muxed too.
__________________
MultiMakeMKV: MakeMKV batch processing (Win) MultiShrink: DVD Shrink batch processing Offizieller Übersetzer von DVD Shrink deutsch Last edited by Chetwood; 27th August 2014 at 10:33. |
|
27th August 2014, 22:47 | #9 | Link | |
Registered User
Join Date: Mar 2011
Posts: 5
|
Quote:
That worked! thanks again. This will save me a lot of time. |
|
29th August 2014, 04:38 | #10 | Link |
Member
Join Date: Aug 2012
Posts: 18
|
My short suggestion:
Code:
:: lets go @ECHO OFF &SETLOCAL disableDelayedExpansion md output 2>nul for %%a in (*.mkv) do mkvmerge -o "output\%%~a" -S "%%~a" --language eng "%%~na.track02.srt" |
29th August 2014, 06:10 | #11 | Link |
Registered User
Join Date: Nov 2001
Posts: 1,104
|
Right, known resource but since he mentioned subs I thought it'd be better to offer setting defaults and stuff as well.
__________________
MultiMakeMKV: MakeMKV batch processing (Win) MultiShrink: DVD Shrink batch processing Offizieller Übersetzer von DVD Shrink deutsch |
29th August 2014, 13:55 | #13 | Link |
Registered User
Join Date: Sep 2006
Posts: 2,197
|
can I create a batch file as well when I want to mux video + audio + subs for a TV series so that I wont have to do all the clicking for all the episodes of a season separately? does anyone know how I could do that?
the file names are all similar in such a case, only difference would be the S0XE0X season/episode part of the name.
__________________
Laptop Lenovo Legion 5 17IMH05: i5-10300H, 16 GB Ram, NVIDIA GTX 1650 Ti (+ Intel UHD 630), Windows 10 x64, madVR (x64), MPC-HC (x64), LAV Filter (x64), XySubfilter (x64) (K-lite codec pack) |
29th August 2014, 15:48 | #15 | Link |
Registered User
Join Date: Sep 2006
Posts: 2,197
|
actually it is.
example: blablaS01E01.mkv blablaS01E01.dtsma blablaS01E01.ass blablaS01E02.mkv blablaS01E02.dtsma blablaS01E02.ass...
__________________
Laptop Lenovo Legion 5 17IMH05: i5-10300H, 16 GB Ram, NVIDIA GTX 1650 Ti (+ Intel UHD 630), Windows 10 x64, madVR (x64), MPC-HC (x64), LAV Filter (x64), XySubfilter (x64) (K-lite codec pack) |
29th August 2014, 17:06 | #17 | Link |
Registered User
Join Date: Sep 2006
Posts: 2,197
|
where do I need to make the change if each output file should have a slightly different name if I choose to output in the same directory?
e.g. instead of blablaS01E01.mkv/.dtsma/.ass all output names should be named "outputblablaS01E01.mkv" so I wont override my input video file. edit: its got to be for %%a in (*.mkv) do mkvmerge -o "output%%a" "%%a" "%%~na.dtsma" "%%~na.ass" then, right?
__________________
Laptop Lenovo Legion 5 17IMH05: i5-10300H, 16 GB Ram, NVIDIA GTX 1650 Ti (+ Intel UHD 630), Windows 10 x64, madVR (x64), MPC-HC (x64), LAV Filter (x64), XySubfilter (x64) (K-lite codec pack) Last edited by Thunderbolt8; 29th August 2014 at 18:15. |
30th August 2014, 01:14 | #19 | Link | |
Member
Join Date: Aug 2012
Posts: 18
|
Quote:
Wer lesen kann, ist echt im Vorteil --language TID:language Sets the language for the given track (see section track IDs). Both ISO639-2 language codes and ISO639-1 country codes are allowed. The country codes will be converted to language codes automatically. All languages including their ISO639-2 codes can be listed with the --list-languages option. This option can be used multiple times for an input file applying to several tracks by selecting different track IDs each time. |
|
|
|