Batch Convert 1000+ DVD to Digital

Page 3 - Seeking answers? Join the Tom's Hardware community: where nearly two million members share solutions and discuss the latest tech.

paecificjr

Honorable
Nov 24, 2013
65
0
10,630
Hello everyone, I wish I had come here before I started this project, but where is the fun in that right? At work we have/had 3 shelves full of DVDs that were just sitting there. Thus I came up with the idea to make them digital. I did some poking around and figured that imgBurn was the right tool to convert them to ISO. Every ISO is correct and the ISO plays fine in VLC player. The problem is that I now have 1 TB of data that needs converted to MP4 or MKV so that other people can use them easier. I have tried everything. I started with Handbrake, but that wouldn't see all of the tracks. I have now tried MakeMKV, which gets 5 of 6 in my test (2 sources 3 tracks each). The one that it doesn't get will only output 27 seconds of the 13 minute long video.

So in summary my questions is, what software should I have used to digitize them? What should I use to convert them to another format? How can I get some batch processing to work, because I am way too lazy to do this one by one?
 
Solution
Ok.. It was my understanding that makemkv could create directories but maybe not. What if you create the directory first with mkdir command? the if else statement just tests weather the directory already exist..
Code:
@echo off
for %%X in (*.iso) do (
    if not exist "C:\Users\Administrator\Documents\TestOutput\%%~nX" (
        echo creating directory "C:\Users\Administrator\Documents\TestOutput\%%~nX"
        mkdir "C:\Users\Administrator\Documents\TestOutput\%%~nX"
    )
    else (
        echo directory "C:\Users\Administrator\Documents\TestOutput\%%~nX" already exists
    )

    "C:\Program Files (x86)\MakeMKV\makemkvcon.exe" mkv iso:"%%X" all "C:\Users\Administrator\Documents\TestOutput\%%~nX"
)
Okay, now we have errors to work with. I sent the output to a log file.

MakeMKV v1.10.2 win(x86-release) started
Using direct disc access mode
The source file 'VTS_01_0.IFO' is corrupt or invalid at offset 2052, attempting to work around
Title #1 was added (118 cell(s), 1:02:50)
Operation successfully completed
Saving 1 titles into directory C:\Users\Administrator\Documents\TestOutput\C:\Users\Administrator\Documents\Input Test\Global Agriculture and Veterinary Medicine DV-5257
File C:\Users\Administrator\Documents\TestOutput\C:\Users\Administrator\Documents\Input Test\Global Agriculture and Veterinary Medicine DV-5257/title00.mkv already exist. Do you want to overwrite it?
Error 'OS error - The filename, directory name, or volume label syntax is incorrect' occurred while creating 'C:\Users\Administrator\Documents\TestOutput\C:\Users\Administrator\Documents\Input Test\Global Agriculture and Veterinary Medicine DV-5257/title00.mkv'
Failed to save title 0 to file C:\Users\Administrator\Documents\TestOutput\C:\Users\Administrator\Documents\Input Test\Global Agriculture and Veterinary Medicine DV-5257/title00.mkv
0 titles saved, 1 failed
Copy complete. 0 titles saved, 1 failed.
MakeMKV v1.10.2 win(x86-release) started
Failed to open disc
MakeMKV v1.10.2 win(x86-release) started
Using direct disc access mode
The source file 'VTS_01_0.IFO' is corrupt or invalid at offset 2052, attempting to work around
Title #1 was added (20 cell(s), 0:10:35)
The source file 'VTS_02_0.IFO' is corrupt or invalid at offset 2052, attempting to work around
Title #2 was added (9 cell(s), 0:04:25)
The source file 'VTS_03_0.IFO' is corrupt or invalid at offset 2052, attempting to work around
Title #3 was added (12 cell(s), 0:06:04)
The source file 'VTS_04_0.IFO' is corrupt or invalid at offset 2052, attempting to work around
Title #4 was added (10 cell(s), 0:05:21)
The source file 'VTS_05_0.IFO' is corrupt or invalid at offset 2052, attempting to work around
Title #5 was added (8 cell(s), 0:04:13)
The source file 'VTS_06_0.IFO' is corrupt or invalid at offset 2052, attempting to work around
Title #6 was added (40 cell(s), 0:21:36)
The source file 'VTS_07_0.IFO' is corrupt or invalid at offset 2052, attempting to work around
Title #7 was added (12 cell(s), 0:06:05)
Operation successfully completed
Saving 7 titles into directory C:\Users\Administrator\Documents\TestOutput\C:\Users\Administrator\Documents\Input Test\Grand Rounds DV-5008A DV-5008B DV-5008C DV-5008D DV-5008E
File C:\Users\Administrator\Documents\TestOutput\C:\Users\Administrator\Documents\Input Test\Grand Rounds DV-5008A DV-5008B DV-5008C DV-5008D DV-5008E/title00.mkv already exist. Do you want to overwrite it?
File C:\Users\Administrator\Documents\TestOutput\C:\Users\Administrator\Documents\Input Test\Grand Rounds DV-5008A DV-5008B DV-5008C DV-5008D DV-5008E/title01.mkv already exist. Do you want to overwrite it?
File C:\Users\Administrator\Documents\TestOutput\C:\Users\Administrator\Documents\Input Test\Grand Rounds DV-5008A DV-5008B DV-5008C DV-5008D DV-5008E/title02.mkv already exist. Do you want to overwrite it?
File C:\Users\Administrator\Documents\TestOutput\C:\Users\Administrator\Documents\Input Test\Grand Rounds DV-5008A DV-5008B DV-5008C DV-5008D DV-5008E/title03.mkv already exist. Do you want to overwrite it?
File C:\Users\Administrator\Documents\TestOutput\C:\Users\Administrator\Documents\Input Test\Grand Rounds DV-5008A DV-5008B DV-5008C DV-5008D DV-5008E/title04.mkv already exist. Do you want to overwrite it?
File C:\Users\Administrator\Documents\TestOutput\C:\Users\Administrator\Documents\Input Test\Grand Rounds DV-5008A DV-5008B DV-5008C DV-5008D DV-5008E/title05.mkv already exist. Do you want to overwrite it?
File C:\Users\Administrator\Documents\TestOutput\C:\Users\Administrator\Documents\Input Test\Grand Rounds DV-5008A DV-5008B DV-5008C DV-5008D DV-5008E/title06.mkv already exist. Do you want to overwrite it?
Error 'OS error - The filename, directory name, or volume label syntax is incorrect' occurred while creating 'C:\Users\Administrator\Documents\TestOutput\C:\Users\Administrator\Documents\Input Test\Grand Rounds DV-5008A DV-5008B DV-5008C DV-5008D DV-5008E/title00.mkv'
Failed to save title 0 to file C:\Users\Administrator\Documents\TestOutput\C:\Users\Administrator\Documents\Input Test\Grand Rounds DV-5008A DV-5008B DV-5008C DV-5008D DV-5008E/title00.mkv
Error 'OS error - The filename, directory name, or volume label syntax is incorrect' occurred while creating 'C:\Users\Administrator\Documents\TestOutput\C:\Users\Administrator\Documents\Input Test\Grand Rounds DV-5008A DV-5008B DV-5008C DV-5008D DV-5008E/title01.mkv'
Failed to save title 1 to file C:\Users\Administrator\Documents\TestOutput\C:\Users\Administrator\Documents\Input Test\Grand Rounds DV-5008A DV-5008B DV-5008C DV-5008D DV-5008E/title01.mkv
Error 'OS error - The filename, directory name, or volume label syntax is incorrect' occurred while creating 'C:\Users\Administrator\Documents\TestOutput\C:\Users\Administrator\Documents\Input Test\Grand Rounds DV-5008A DV-5008B DV-5008C DV-5008D DV-5008E/title02.mkv'
Failed to save title 2 to file C:\Users\Administrator\Documents\TestOutput\C:\Users\Administrator\Documents\Input Test\Grand Rounds DV-5008A DV-5008B DV-5008C DV-5008D DV-5008E/title02.mkv
Error 'OS error - The filename, directory name, or volume label syntax is incorrect' occurred while creating 'C:\Users\Administrator\Documents\TestOutput\C:\Users\Administrator\Documents\Input Test\Grand Rounds DV-5008A DV-5008B DV-5008C DV-5008D DV-5008E/title03.mkv'
Failed to save title 3 to file C:\Users\Administrator\Documents\TestOutput\C:\Users\Administrator\Documents\Input Test\Grand Rounds DV-5008A DV-5008B DV-5008C DV-5008D DV-5008E/title03.mkv
Error 'OS error - The filename, directory name, or volume label syntax is incorrect' occurred while creating 'C:\Users\Administrator\Documents\TestOutput\C:\Users\Administrator\Documents\Input Test\Grand Rounds DV-5008A DV-5008B DV-5008C DV-5008D DV-5008E/title04.mkv'
Failed to save title 4 to file C:\Users\Administrator\Documents\TestOutput\C:\Users\Administrator\Documents\Input Test\Grand Rounds DV-5008A DV-5008B DV-5008C DV-5008D DV-5008E/title04.mkv
Error 'OS error - The filename, directory name, or volume label syntax is incorrect' occurred while creating 'C:\Users\Administrator\Documents\TestOutput\C:\Users\Administrator\Documents\Input Test\Grand Rounds DV-5008A DV-5008B DV-5008C DV-5008D DV-5008E/title05.mkv'
Failed to save title 5 to file C:\Users\Administrator\Documents\TestOutput\C:\Users\Administrator\Documents\Input Test\Grand Rounds DV-5008A DV-5008B DV-5008C DV-5008D DV-5008E/title05.mkv
Error 'OS error - The filename, directory name, or volume label syntax is incorrect' occurred while creating 'C:\Users\Administrator\Documents\TestOutput\C:\Users\Administrator\Documents\Input Test\Grand Rounds DV-5008A DV-5008B DV-5008C DV-5008D DV-5008E/title06.mkv'
Failed to save title 6 to file C:\Users\Administrator\Documents\TestOutput\C:\Users\Administrator\Documents\Input Test\Grand Rounds DV-5008A DV-5008B DV-5008C DV-5008D DV-5008E/title06.mkv
0 titles saved, 7 failed
Copy complete. 0 titles saved, 7 failed.



 
Hopefully you can see where this went awry. I replu via mobile so hard to debug. Bolded where the variable/file parsing the full path instead of just the file name.

"C:\Users\Administrator\Documents\TestOutput\C:\Users\Administrator\Documents\Input Test\Grand Rounds DV-5008A DV-5008B DV-5008C DV-5008D DV-5008E/title06.mkv"

Change "%%~dpnX" to ""%%~nX"

Code:
@echo off
for %%X in (*.iso) do (
    "C:\Program Files (x86)\MakeMKV\makemkvcon.exe" mkv iso:"%%X" all "C:\Users\Administrator\Documents\TestOutput\%%~nX"
)
 
Here you go...
MakeMKV v1.10.2 win(x86-release) started
Using direct disc access mode
The source file 'VTS_01_0.IFO' is corrupt or invalid at offset 2052, attempting to work around
Title #1 was added (118 cell(s), 1:02:50)
Operation successfully completed
Saving 1 titles into directory C:\Users\Administrator\Documents\TestOutput\Global Agriculture and Veterinary Medicine DV-5257
Error 'OS error - The system cannot find the path specified' occurred while creating 'C:\Users\Administrator\Documents\TestOutput\Global Agriculture and Veterinary Medicine DV-5257/title00.mkv'
Failed to save title 0 to file C:\Users\Administrator\Documents\TestOutput\Global Agriculture and Veterinary Medicine DV-5257/title00.mkv
0 titles saved, 1 failed
Copy complete. 0 titles saved, 1 failed.
MakeMKV v1.10.2 win(x86-release) started
Failed to open disc
MakeMKV v1.10.2 win(x86-release) started
Using direct disc access mode
The source file 'VTS_01_0.IFO' is corrupt or invalid at offset 2052, attempting to work around
Title #1 was added (20 cell(s), 0:10:35)
The source file 'VTS_02_0.IFO' is corrupt or invalid at offset 2052, attempting to work around
Title #2 was added (9 cell(s), 0:04:25)
The source file 'VTS_03_0.IFO' is corrupt or invalid at offset 2052, attempting to work around
Title #3 was added (12 cell(s), 0:06:04)
The source file 'VTS_04_0.IFO' is corrupt or invalid at offset 2052, attempting to work around
Title #4 was added (10 cell(s), 0:05:21)
The source file 'VTS_05_0.IFO' is corrupt or invalid at offset 2052, attempting to work around
Title #5 was added (8 cell(s), 0:04:13)
The source file 'VTS_06_0.IFO' is corrupt or invalid at offset 2052, attempting to work around
Title #6 was added (40 cell(s), 0:21:36)
The source file 'VTS_07_0.IFO' is corrupt or invalid at offset 2052, attempting to work around
Title #7 was added (12 cell(s), 0:06:05)
Operation successfully completed
Saving 7 titles into directory C:\Users\Administrator\Documents\TestOutput\Grand Rounds DV-5008A DV-5008B DV-5008C DV-5008D DV-5008E
Error 'OS error - The system cannot find the path specified' occurred while creating 'C:\Users\Administrator\Documents\TestOutput\Grand Rounds DV-5008A DV-5008B DV-5008C DV-5008D DV-5008E/title00.mkv'
Failed to save title 0 to file C:\Users\Administrator\Documents\TestOutput\Grand Rounds DV-5008A DV-5008B DV-5008C DV-5008D DV-5008E/title00.mkv
Error 'OS error - The system cannot find the path specified' occurred while creating 'C:\Users\Administrator\Documents\TestOutput\Grand Rounds DV-5008A DV-5008B DV-5008C DV-5008D DV-5008E/title01.mkv'
Failed to save title 1 to file C:\Users\Administrator\Documents\TestOutput\Grand Rounds DV-5008A DV-5008B DV-5008C DV-5008D DV-5008E/title01.mkv
Error 'OS error - The system cannot find the path specified' occurred while creating 'C:\Users\Administrator\Documents\TestOutput\Grand Rounds DV-5008A DV-5008B DV-5008C DV-5008D DV-5008E/title02.mkv'
Failed to save title 2 to file C:\Users\Administrator\Documents\TestOutput\Grand Rounds DV-5008A DV-5008B DV-5008C DV-5008D DV-5008E/title02.mkv
Error 'OS error - The system cannot find the path specified' occurred while creating 'C:\Users\Administrator\Documents\TestOutput\Grand Rounds DV-5008A DV-5008B DV-5008C DV-5008D DV-5008E/title03.mkv'
Failed to save title 3 to file C:\Users\Administrator\Documents\TestOutput\Grand Rounds DV-5008A DV-5008B DV-5008C DV-5008D DV-5008E/title03.mkv
Error 'OS error - The system cannot find the path specified' occurred while creating 'C:\Users\Administrator\Documents\TestOutput\Grand Rounds DV-5008A DV-5008B DV-5008C DV-5008D DV-5008E/title04.mkv'
Failed to save title 4 to file C:\Users\Administrator\Documents\TestOutput\Grand Rounds DV-5008A DV-5008B DV-5008C DV-5008D DV-5008E/title04.mkv
Error 'OS error - The system cannot find the path specified' occurred while creating 'C:\Users\Administrator\Documents\TestOutput\Grand Rounds DV-5008A DV-5008B DV-5008C DV-5008D DV-5008E/title05.mkv'
Failed to save title 5 to file C:\Users\Administrator\Documents\TestOutput\Grand Rounds DV-5008A DV-5008B DV-5008C DV-5008D DV-5008E/title05.mkv
Error 'OS error - The system cannot find the path specified' occurred while creating 'C:\Users\Administrator\Documents\TestOutput\Grand Rounds DV-5008A DV-5008B DV-5008C DV-5008D DV-5008E/title06.mkv'
Failed to save title 6 to file C:\Users\Administrator\Documents\TestOutput\Grand Rounds DV-5008A DV-5008B DV-5008C DV-5008D DV-5008E/title06.mkv
0 titles saved, 7 failed
Copy complete. 0 titles saved, 7 failed.

 
Ok.. It was my understanding that makemkv could create directories but maybe not. What if you create the directory first with mkdir command? the if else statement just tests weather the directory already exist..
Code:
@echo off
for %%X in (*.iso) do (
    if not exist "C:\Users\Administrator\Documents\TestOutput\%%~nX" (
        echo creating directory "C:\Users\Administrator\Documents\TestOutput\%%~nX"
        mkdir "C:\Users\Administrator\Documents\TestOutput\%%~nX"
    )
    else (
        echo directory "C:\Users\Administrator\Documents\TestOutput\%%~nX" already exists
    )

    "C:\Program Files (x86)\MakeMKV\makemkvcon.exe" mkv iso:"%%X" all "C:\Users\Administrator\Documents\TestOutput\%%~nX"
)
 
Solution
Okay that worked! I have one video that failed to convert, but the ISO also fails to play, thus not a problem. I have a few ideas that would make this the ultimate tool.
First: Is there a way to check if the file fails can I output it to a list so that I can see which ones fail?
Second: Is there a way to name the files automatically?

 
The best way I can think of is to redirect the output from console to a log text file then search for "failed" in this way you can see if individual titles fail to save to mkv and not just whole disk which you could just search for empty output directory.

Automatic naming is easy. Please give me time tonight after work to put this into a script.
 
sorry it has taken a long time to respond. To enable logging you need a version of "tee" program. download wintee and put wtee.exe in the iso folder, same folder where mkv.bat is located.
https://code.google.com/archive/p/wintee/downloads

then run:
btw | is the 'pipe' symbol, not an L or i. commonly it is "shift+\"
Code:
mkv.bat 2>&1 | wtee.exe mkv.log

Here is my updated mkv.bat batch file.
I suggest if you have not already done so that you copy a few iso to a test folder and try out this batch file before running it on 1000 iso.

Code:
@echo off

for %%X in (*.iso) do (
    if not exist "C:\Users\Administrator\Documents\TestOutput\%%~nX" (
        echo creating directory "C:\Users\Administrator\Documents\TestOutput\%%~nX"
        mkdir "C:\Users\Administrator\Documents\TestOutput\%%~nX"
    ) else (
        echo directory "C:\Users\Administrator\Documents\TestOutput\%%~nX" already exists
    )

    "C:\Program Files (x86)\MakeMKV\makemkvcon.exe" mkv iso:"%%X" all "C:\Users\Administrator\Documents\TestOutput\%%~nX"
    
    setlocal EnableDelayedExpansion
    for %%Y in ("C:\Users\Administrator\Documents\TestOutput\%%~nX\title*.mkv") do (
        set titleNum=%%~nY
        echo ren "%%Y" "%%~nX - !titleNum:~5!.mkv"
        ren "%%Y" "%%~nX - !titleNum:~5!.mkv"
    )
)

The second for loop looks for files in the current output directory/iso name named title*.mkv and renames them with the output directory/iso name - {title number}
 
That works extraordinarily well!

We have one final question here. Is there a way we could convert them and not have the output files go to a subfolder. We plan on uploading them to the cloud and it would be much easier to drag over individual files that are in one collective folder.
 
you can either use the windows explorer search tool and search for "*.mkv" and that will bring up all mkv files that you can use in drag'n'drop applications. or use this for loop, stick it at the end of your batch file or make a new batch file it does not matter. Make a new folder where you want all mkv copied, for example "C:\Users\Administrator\Documents\AllOutput".

Code:
for /R "C:\Users\Administrator\Documents\TestOutput" %%z in (*.mkv) do (
    move "%%z" "C:\Users\Administrator\Documents\AllOutput\"
)

the modifer, /R, means recursive. ie search through all sub directories and do following on any file with extension ".mkv"

You can find documentation on all of these commands by typing "help command" for example the help on the for command is quite extensive

Code:
help for
 
I'm making progress. I had a small issue with disk space. MKVs are still relatively large. I fixed that by dropping in another terabyte hard drive and I am going to process them in smaller chunks.

My boss's boss came in and looked at the project and asked why we weren't going to mp4 so there will be my next project.
 
Very easy to convert mkv to mp4. Mp4 is simply a different (mkv is technically supperior for various reasons) container, the actual encoded contents can remain the same. Of course you Can also reencode to h.264 to save disk space. Or webm or whatever you want really.

I would use ffmpeg combined with a simple for loop.
Convert to mp4 and keep original tracks.

Code:
ffmpeg -i "c:/users/administrator/documents/input.mkv" -c:v copy -c:a copy -o "c:/users/administrator/documents/output.mp4"

Convert to h.264+aac Something like

Code:
ffmpeg -i "c:/users/administrator/documents/input.mkv" -c:v libx264 -preset fast -crf 22 -c:a aac -b:a 160k -o "c:/users/administrator/documents/output.mp4"

Hopefully that steers you in the right direction.
 
I'm not sure if this is a problem we can fix, but every now and then a file will get stuck and it won't continue past that file. The script will sit on it for over 30 minutes before I cut it with a ctrl c. It still outputs the file though. Any thoughts?

Edit:
And how do I set the minimum title length? Right now it is at 2 minutes. I would like it set to 30 seconds just in the event that someone needs that super short clip.

Edit of the Edit:
After it completed overnight it had 17 files that didn't convert, along with 21 which didn't get the chance due to low storage. I'm working on moving files around to see if those files that didn't convert the first time convert better the second time.