Batch processing of ISO to MKV

MKV playback, recompression, remuxing, codec packs, players, howtos, etc.
Post Reply
psyfer9983
Posts: 2
Joined: Tue Mar 12, 2024 12:30 am

Batch processing of ISO to MKV

Post by psyfer9983 »

Hello all. I thought I might share my new method of processing ISO files to MKVs. You will need update the paths to your system but this has worked perfectly for my needs. Its a "for" loop that will run across all ISO files in the folder the script is located in.

Save the below code as a "filenamehere.bat" batch file in the same place as your ISO files.

Code: Select all

for /r %%m in (*.iso) do (
    md "Y:\ISO_MAKEMKV\%%~nm"
    "C:\Program Files (x86)\MakeMKV\makemkvcon64.exe" --minlength=600 mkv "%%m" all Y:\ISO_MAKEMKV\%%~nm
)
Once you save the script, making path changes as needed, you should be able to just put ISO files in the same place as the script (bat file) and run it. Fair warning, make sure you have enough drive space as this will not stop until you close (terminate) the script or it finishes processing the ISO files and it will not warn you of low disk space.

Breakdown of the script:

1) The "for /r %%m in (*.iso) do (" is the loop. For each ISO file in the root folder where the batch file resides it will run the next parts. Please note this should also work recursively on every file from the start of the root folder so it may run on files in subfolders. I know this may cause issues with the next command.

2) The "md "Y:\ISO_MAKEMKV\%%~nm"" is the first command to run in the loop. This just creates a folder from the ISO filename that helps eliminate file overwrites. If you have files in subfolders, this will only create a folder with the ISO filename. It will not keep the folder structure at all in the current form of the script.

3) The " "C:\Program Files (x86)\MakeMKV\makemkvcon64.exe" --minlength=600 mkv "%%m" all Y:\ISO_MAKEMKV\%%~nm " is the second command in the loop. This is what converts the title or titles from the ISO to MKV(s). The "minlength=600" is to eliminate any title that is not at least 600 seconds in length and can be adjusted to whatever you need. Update the MakeMKV install path if needed.

Again you will need to update the paths for your system. You should only need to change "Y:\ISO_MAKEMKV" to whatever you need (ex C:\output) unless you installed MakeMKV to a different install path. Be sure to leave %%m and %%~nm alone as they are used for the "for" parameters in the loop.

Hope this helps out someone.
psyfer9983
Posts: 2
Joined: Tue Mar 12, 2024 12:30 am

Re: Batch processing of ISO to MKV

Post by psyfer9983 »

First issue with this script and it was all due to missing "quotes" in part of the script. Need to add quotes around Y:\ISO_MAKEMKV\%%~nm so its "Y:\ISO_MAKEMKV\%%~nm". "Makemkvcon" and "makemkvcon64" doesn't like spaces in the output path without quotes. New script code below.

Code: Select all

for /r %%m in (*.iso) do (
    md "Y:\ISO_MAKEMKV\%%~nm"
    "C:\Program Files (x86)\MakeMKV\makemkvcon64.exe" --minlength=600 mkv "%%m" all "Y:\ISO_MAKEMKV\%%~nm"
)
Post Reply