How can I create a .bat file for making mkv files?

Everything related to MakeMKV
Post Reply
nzdreamer55
Posts: 14
Joined: Sun Nov 07, 2010 3:43 am

How can I create a .bat file for making mkv files?

Post by nzdreamer55 »

Hello everyone,

I have a lot of DVD movies and TV series that I want to create mkv files for, however the process of inserting each disk and then going through the GUI to select what I want and then telling it to make the mkv files is a little daunting. I want to create a .bat file that will do this however I am running into a few glitches. I wound this:

http://www.makemkv.com/developers/usage.txt

Which was helpful and tried the following

makemkvcon mkv disc:0 all c:\folder

and

makemkvcon backup --decrypt --cache=16 --noscan -r --progress=-same disc:0 c:\folder

but neither seems to output the titles of the DVD to MKV files.

Any help is appreciated.

Currently I am on win7 home edition and am using MakeMKV_v1.6.16.

Steve
dlang123
Posts: 3
Joined: Thu Dec 15, 2011 3:27 am

Re: How can I create a .bat file for making mkv files?

Post by dlang123 »

I was thinking about doing the same thing...

Did you ever get this to work?

From the looks of it, are you trying to automate it from you disc drive or from files on your computer?

What are your errors?

makemkvcon mkv disc:0 all c:\folder

should be the normal line to use for this I would think..

C:\Program Files (x86)\MakeMKV>makemkvcon64.exe mkv --minlength=600 file:"C:\Program Files (x86
)\MakeMKV\Rango\VIDEO_TS" all .

creates an mkv for me in the makemkv folder of the movie rango with the minimum title length of 10mins to cut out all the annoying stuff.
nzdreamer55
Posts: 14
Joined: Sun Nov 07, 2010 3:43 am

Re: How can I create a .bat file for making mkv files?

Post by nzdreamer55 »

Thank you dlang so much for replying. I was not sure that I would find help here with this type of question. :D

So I would like to create a bat file that copies an entire DVD. These are all standard definition DVDs that I own, but want to put them on my home server. I didn't get this to work yet.
dlang123 wrote:From the looks of it, are you trying to automate it from you disc drive or from files on your computer?
Yes! The first thing you said is correct. I want to put a DVD into the drive and be able to click on my bat file. From there I would like all the magic that MakeMKV does to go to work scaning the drive, pulling out the video and audio tracts and putting them into a mkv container file on my hard drive.
dlang123 wrote:What are your errors?
Here is info from the cmd window

Code: Select all

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

C:\Users\Kira>path="C:\Program Files (x86)\MakeMKV"

C:\Users\Kira>makemkvcon mkv disc:0 all c:\folder
MakeMKV v1.6.16 win(x86-release) started
Debug logging enabled, log will be saved as C:\Users\Kira/MakeMKV_log.txt
Using direct disc access mode
Title #0 has length of 15 seconds which is less than minimum title length of 120
 seconds and was therefore skipped
Title #2 was added (17 cell(s), 1:31:59)
Title #3 has length of 10 seconds which is less than minimum title length of 120
 seconds and was therefore skipped
Title #4 was added (1 cell(s), 0:05:12)
Title #5 was added (1 cell(s), 0:02:04)
DEBUG: Code 233 at qz+sI+K5IZDgYc8P/OPNjkmG:0
Operation successfully completed
Saving 3 titles into directory c:\folder
DEBUG: Code 0 at =q?-Wawh_a0iR#)7o]y\:121263061
DEBUG: Code 3 at Zt.Y|H:0@F|-DSupOPrP.:213129892
Failed to save title 0 to file c:\folder/title00.mkv
DEBUG: Code 3 at Zt.Y|H:0@F|-DSupOPrP.:213129892
Failed to save title 1 to file c:\folder/title01.mkv
DEBUG: Code 3 at Zt.Y|H:0@F|-DSupOPrP.:213129892
Failed to save title 2 to file c:\folder/title02.mkv
0 titles saved, 3 failed
Copy complete. 0 titles saved, 3 failed.

C:\Users\Kira>
That being said, I then created the folder c:\folder and it worked perfectly.

So I think that to make this really smooth, I need some way to take the info from the DVD and have a folder created with this on it so I can just keep feeding in DVD's and then sort it all out later.


BTW since I am using win 7 x64 should I be using makemkvcon64.exe instead of makemkvcon?

I would really love to have the bat triggered when a DVD is put into the drive, but I think I can select an application or bat file from the autoplay settings.

Thanks for the help

Steve
nzdreamer55
Posts: 14
Joined: Sun Nov 07, 2010 3:43 am

Re: How can I create a .bat file for making mkv files?

Post by nzdreamer55 »

A Little follow up on this...

So I see that I can use the "makemkvcon -r info" command and get the title of the DVD that is in my DVD drive. The data is very easy to read, however from there I not sure how to take from that just the title of the DVD. Also no matter what I try, it seems that it will check for up to 15 drives. I've tried putting the disc:0 at the end of this but I still get all 15 drives. It does note that only one is visible. It seems like if I could in my bat file capture this info into a variable then I could use that variable to create a folder named the variable and my problems would be solved. Just not sure how to do this. Not sure that this is the right place for this type of help, but will take any that people have. Thank you in advance.

Steve
dlang123
Posts: 3
Joined: Thu Dec 15, 2011 3:27 am

Re: How can I create a .bat file for making mkv files?

Post by dlang123 »

Hmm trying to automate it like that is a good question...

I normally do most of my programming on linux and not in Windows bat files, so you could capture the whole string to multiple variables, and then split on the , token


Then you just find the proper first token that matches your DVD player.. which for me is DRV:0 and use the token[5] which is the DVD title from the looks of it..

But it might actually be easier to use the vol command which shows something more along the
Volume in drive E is <name>
Volume Serial Number is <blah>

but I would personally be doing it with folders that are already ripped, so I can't help you much there I'm afraid.
dlang123
Posts: 3
Joined: Thu Dec 15, 2011 3:27 am

Re: How can I create a .bat file for making mkv files?

Post by dlang123 »

Might want to take a look here too, either of these would split a string for you.

http://stackoverflow.com/questions/1707 ... batch-file
nzdreamer55
Posts: 14
Joined: Sun Nov 07, 2010 3:43 am

Re: How can I create a .bat file for making mkv files?

Post by nzdreamer55 »

So with the help from members at www.sevenforum.com I was able to do it.

My solution isn't too elegant and there are somethings that you need to know before running the the bat.
1)you need to add a menu item to the autoplay function of windows so that it will launch the bat. See here
http://www.sevenforums.com/general-disc ... ost1703162

2)You need to have a program called nircmd.exe to open the DVD after Makemkv finishes with it.
Lastly you need to use mapped drive letters as when I tried to use network addresses, it didn't work.

When you put a DVD in it will get the DVD title, make a folder with this title and use it as the target for makemkv. Once all of the titles have been created, the DVD is ejected.

Here is the bat file

Code: Select all

::mkvbat

@ECHO OFF

SETLOCAL ENABLEDELAYEDEXPANSION
REM process each line of output from command

REM You will replace ("!var0!") below with ('your command')

Path="C:\Program Files (x86)\MakeMKV"
FOR /F "TOKENS=*" %%a IN ('makemkvcon64.exe -r info') DO (

REM save in local variable for easier complex DOS script lines
SET vara=%%a

REM parse 1st value before first colon for this output line
FOR /F "TOKENS=1 DELIMS=:" %%f IN ("!vara!") DO (

REM if drv then we have something to examine
IF /I %%f == drv (

REM replace double-quote with @ for parsing
SET varanq=!vara:"=@!

REM get 1st chunk after first @ 
FOR /F "TOKENS=2 DELIMS=@" %%h IN ("!varanq!") DO (

SET var=%%h
REM parse 3 bytes from beginning which is just after @
SET var2=!var:~0,3!

REM DVD? note slashI option to ignore case
IF /I !var2! == dvd (

REM parse 6th chunk comma-delimited
FOR /F "TOKENS=6 DELIMS=," %%t IN ("!varanq!") DO (

REM now remove @s on each end
FOR /F "TOKENS=1 DELIMS=@" %%y IN ("%%t") DO (

SET mydir=%%y
ECHO final !mydir!
MKDIR Z:\!mydir!\

)
)
)
)
) 
)
)
makemkvcon64.exe --messages=null mkv disc:0 all Z:\!mydir!\
Path=C:\Program Files (x86)\Nircmd
nircmd.exe cdrom open f:
EXIT
-S
shagatte
Posts: 2
Joined: Thu Apr 04, 2013 8:54 am

Re: How can I create a .bat file for making mkv files?

Post by shagatte »

Hello,

That's two days I'm trying without success to create a batch file with the command line. I found some tracks and solutions to your forum. Very handy indeed! ;) But I am faced with a problem that I can not seem to solve.

I reproduced the following bat file, which works very well on my PC.
But when I try to run it on another machine where I would make my rip.
That plant: batch does not create the directory with the name of the movie.

But by entering the command line by hand to access the information in the DVD, it does not break problems. This is good!

But during the execution of the batch, it repere not the DVD player, and therefore stopped the process because it can not find the name of the directory to create ...

I tried to identify with the dvd disc1 disc0 see because of the RAID without success!

Code: Select all

::mkvbat

@ECHO OFF

SETLOCAL ENABLEDELAYEDEXPANSION
REM process each line of output from command

REM You will replace ("!var0!") below with ('your command')

Path="C:\Program Files (x86)\MakeMKV\"
FOR /F "TOKENS=*" %%a IN ('makemkvcon64.exe -r info') DO (

REM I've tried with different solutions :
REM FOR /F "TOKENS=*" %%a IN ('makemkvcon64.exe -r info disc0') DO (
REM FOR /F "TOKENS=*" %%a IN ('makemkvcon64.exe -r info disc1') DO (

REM save in local variable for easier complex DOS script lines
SET vara=%%a

REM parse 1st value before first colon for this output line
FOR /F "TOKENS=1 DELIMS=:" %%f IN ("!vara!") DO (

REM if drv then we have something to examine
IF /I %%f == drv (

REM replace double-quote with @ for parsing
SET varanq=!vara:"=@!

REM get 1st chunk after first @
FOR /F "TOKENS=2 DELIMS=@" %%h IN ("!varanq!") DO (

SET var=%%h
REM parse 3 bytes from beginning which is just after @
SET var2=!var:~0,3!

REM DVD? note slashI option to ignore case
IF /I !var2! == dvd (

REM parse 6th chunk comma-delimited
FOR /F "TOKENS=6 DELIMS=," %%t IN ("!varanq!") DO (

REM now remove @s on each end
FOR /F "TOKENS=1 DELIMS=@" %%y IN ("%%t") DO (

SET mydir=%%y
ECHO final !mydir!
MKDIR Z:\Movies\!mydir!\

)
)
)
)
)
)
)
makemkvcon64.exe --messages=null mkv disc:0 all Z:\Movies\!mydir!\
Path=C:\Program Files (x86)\Nircmd
nircmd.exe cdrom open d:
EXIT

Of course I installed the right software MakeMKV, NirCmd ...
Please help me ! Tks for your help!

@+ LoRenZo

*****************************************
PS: Sorry for my english... [/quote]

****************************************************************
CPU:HexaCore AMD FX-6300- 3817 Mhz
Motherboard:Asus M5A78L-M
GraphicCard:Ati Radeon HD3100(RS780L)
BDDVD W:SN-506BB ATA Device (Toshiba/Samsung)
****************************************************************
Chetwood
Posts: 980
Joined: Mon Aug 30, 2010 9:16 am

Re: How can I create a .bat file for making mkv files?

Post by Chetwood »

MultiMakeMKV: MakeMKV batch processing (Win)
MultiShrink: DVD Shrink batch processing
Offizieller Uebersetzer von DVD Shrink deutsch
shagatte
Posts: 2
Joined: Thu Apr 04, 2013 8:54 am

Re: How can I create a .bat file for making mkv files?

Post by shagatte »

Thank you very mutch. I've found the solution it was a problem on the code :

Code: Select all

 
REM DVD? put "dvd" for DVDPlayer / "BD-" for BLUERAY Player note slashI option to ignore case
IF /I !var2! == BD- (
I need to change "DVD" & remplace it with "BD-" !! ;)

Thanks, au revoir :)
Post Reply