mkvmerge Batch script

September 26, 2010 at 05:34:20
Specs: Windows 7, 4GB
How can I turn this command into a batch command? There is 50 Videos I would like to do this to and they are all the same layout etc all the track numbers/names are the same and each subtitle file has the same name as the .Mkv file it wants to be added to.

If possible I would also like someone to tell me how to create a batch script for Mkvmerge so I don't have to ask every time I need one :D

"C:\Program Files (x86)\MKVtoolnix\mkvmerge.exe" -o "D:\\Folder\\New\\Video.mkv" "--default-track" "1:yes" "--forced-track" "1:no" "--display-dimensions" "1:720x540" "--language" "3:jpn" "--track-name" "3:Japanese (2.0)" "--default-track" "3:no" "--forced-track" "3:no" "-a" "3" "-d" "1" "-S" "-T" "--no-global-tags" "D:\\Folder\\Video.mkv" "--language" "0:eng" "--track-name" "0:English Improved" "--default-track" "0:yes" "--forced-track" "0:no" "-s" "0" "-D" "-A" "-T" "--no-global-tags" "--no-chapters" "D:\\Folder\\Subtitle.srt" "--track-order" "0:1,0:3,1:0"

Thanks


See More: mkvmerge Batch script

Report •

#1
September 30, 2010 at 06:34:15
You've given no relationship between Subtitle.srt and video.mkv. I'd assume you meant video.srt, but you know what they say about assuming.

Report •

#2
September 30, 2010 at 15:18:38
Sorry I did that just in case anyone didn't know that .srt was a subtitle extension, but then I guess if they didn't know that they wouldn't know how to create a batch script for it.

Yes the subtitle is the subtitle.srt and in the actual batch script it will be named Video.srt and the video file is the Video.mkv this has Dual audio and one audio file will be removed.


Report •

#3
September 30, 2010 at 15:33:22
for %%A in (D:\Folder*.mkv) do (
"C:\Program Files (x86)\MKVtoolnix\mkvmerge.exe" -o "D:\Folder\New\%%~nxA" "--default-track" "1:yes" "--forced-track" "1:no" "--display-dimensions" "1:720x540" "--language" "3:jpn" "--track-name" "3:Japanese (2.0)" "--default-track" "3:no" "--forced-track" "3:no" "-a" "3" "-d" "1" "-S" "-T" "--no-global-tags" "D:\Folder\%%~nxA" "--language" "0:eng" "--track-name" "0:English Improved" "--default-track" "0:yes" "--forced-track" "0:no" "-s" "0" "-D" "-A" "-T" "--no-global-tags" "--no-chapters" "D:\Folder\%%~nA.srt" "--track-order" "0:1,0:3,1:0"
)


Report •

Related Solutions

#4
September 30, 2010 at 19:16:54
Thanks but running that in a .bat file doesn't do anything and adding Pause to the end doesnt show any errors. I copied the command into command Prompt and it says

I put the errors in bold.

C:\Windows\system32>)for %%A in (D:\Folder*.mkv) do (
')for' is not recognized as an internal or external command,
operable program or batch file.

C:\Windows\system32>"C:\Program Files (x86)\MKVtoolnix\mkvmerge.exe" -o "D:\Fold
er\New\%%~nxA" "--default-track" "1:yes" "--forced-track" "1:no" "--display-dime
nsions" "1:720x540" "--language" "3:jpn" "--track-name" "3:Japanese (2.0)" "--de
fault-track" "3:no" "--forced-track" "3:no" "-a" "3" "-d" "1" "-S" "-T" "--no-gl
obal-tags" "D:\Folder\%%~nxA" "--language" "0:eng" "--track-name" "0:English Imp
roved" "--default-track" "0:yes" "--forced-track" "0:no" "-s" "0" "-D" "-A" "-T"
"--no-global-tags" "--no-chapters" "D:\Folder\%%~nA.srt" "--track-order" "0:1,0
:3,1:0"

mkvmerge v4.0.0 ('The Stars were mine') built on Jun 5 2010 17:44:09
Error: The source file 'D:\Folder\%%~nxA' could not be opened successfully, or r
etrieving its size by seeking to the end did not work.

C:\Windows\system32>)

thanks


Report •

#5
September 30, 2010 at 22:01:30
There shouldn't be a ) in front of the command.

)for %%A in (D:\Folder*.mkv) do (

removing it should work.


Report •

#6
September 30, 2010 at 22:51:24
Thanks but now its giving a new error :(

I copied the whole command window here is what command Prompt said

Microsoft Windows [Version 6.1.7600]
Copyright (c) 2009 Microsoft Corporation. All rights reserved.

C:\Users\Alex>for %%A in (D:\Folder*.mkv) do (
%%A was unexpected at this time.

C:\Users\Alex>"C:\Program Files (x86)\MKVtoolnix\mkvmerge.exe" -o "D:\Folder\New
\%%~nxA" "--default-track" "1:yes" "--forced-track" "1:no" "--display-dimensions
" "1:720x540" "--language" "3:jpn" "--track-name" "3:Japanese (2.0)" "--default-
track" "3:no" "--forced-track" "3:no" "-a" "3" "-d" "1" "-S" "-T" "--no-global-t
ags" "D:\Folder\%%~nxA" "--language" "0:eng" "--track-name" "0:English Improved"
"--default-track" "0:yes" "--forced-track" "0:no" "-s" "0" "-D" "-A" "-T" "--no
-global-tags" "--no-chapters" "D:\Folder\%%~nA.srt" "--track-order" "0:1,0:3,1:0
"
mkvmerge v4.0.0 ('The Stars were mine') built on Jun 5 2010 17:44:09
Error: The source file 'D:\Folder\%%~nxA' could not be opened successfully, or r
etrieving its size by seeking to the end did not work.

C:\Users\Alex>)

It now thinks that "%%A" is unexpected and cant open D:\Folder\%%~nxA


Report •

#7
September 30, 2010 at 23:47:12
Ok. That is because you are copy and pasting the command into the command prompt. If you want to do this you have to change it to just %A one %. And also %%~nA to just %~nA

example:
for %%A in (D:\Folder*.mkv) do (
change to
for %A in (D:\Folder*.mkv) do (

and

D:\Folder\%%~nA
change to
D:\Folder\%~nA

If you are using it in a .bat file then 2 % is correct.

example:
for %%A in (D:\Folder*.mkv) do (
and
D:\Folder\%%~nA


Report •

#8
October 1, 2010 at 01:47:43
Ah ok thanks that clears that bit up, but when I run the command from a bat file it just flashes a command window and nothing happens. When I add pause to the script no errors are shown it just says the scripts contents but doesnt seem to be running for some reason.

Edit: When changing all %% to % and copying the contents and pasting it into command prompt it gives no errors but asks "More?"


Report •

#9
October 4, 2010 at 21:24:14
Its been 4 days since my last post does anyone know what is wrong with this script that makes it not run in a .bat file?

for %%A in (D:\Folder*.mkv) do (
"C:\Program Files (x86)\MKVtoolnix\mkvmerge.exe" -o "D:\Folder\New\%%~nxA" "--default-track" "1:yes" "--forced-track" "1:no" "--display-dimensions" "1:720x540" "--language" "3:jpn" "--track-name" "3:Japanese (2.0)" "--default-track" "3:no" "--forced-track" "3:no" "-a" "3" "-d" "1" "-S" "-T" "--no-global-tags" "D:\Folder\%%~nxA" "--language" "0:eng" "--track-name" "0:English Improved" "--default-track" "0:yes" "--forced-track" "0:no" "-s" "0" "-D" "-A" "-T" "--no-global-tags" "--no-chapters" "D:\Folder\%%~nA.srt" "--track-order" "0:1,0:3,1:0"
)


Report •

Ask Question