I haven't actually used the output, my TMPGEnc is currently busy processing a large 1080p movie, so I'm not quite sure if the output is what we are looking for.
To make this batch file work, you need to have MKVInfo.exe, MP4Box.exe and MKVInfo.exe in your windows path. You already have theese if you've installed MKVExtractGUI and YAMB. The quickest (and dirtiest) way to achieve this, is to copy them into your system folder (in XP that is C:/WINDOWS/System32/).
Copy/Paste the script into a txt file and save it as "ExtractMKVVideoAndConvertToMOV.bat". Place it where you'd like on your hard drive and double-click it. It will process all MKV's in current directory and all sub-folders. Make sure that you have enough free space on your hdd before executing the script.
It will not work on MKV's with more than 1 video track, in that case it will only process the last one.
Bear in mind that this is my first batch script ever, so I'm sure that it could be optimized. Please give feedback.
@REM Processes all MKV's in current folder and its subfolders. Does not process the same file twice.
@REM if you don't want the job to include subfolders, remove the "/s" from the below satement.
FOR /F "delims=" %%C in ('DIR /b /s *.mkv') DO CALL :Process %%C
@REM CHECK IF FILE HAS BEEN PROCESSED AND IF SO, SKIP IT
IF EXIST %1.mov GOTO :END
@REM make a txt file with the info on the MKV
MKVINFO %1 >>MKVInfo.txt
@REM Get the trackId of the video file and save it to a file
FOR /F "tokens=2 delims=:" %%A IN ('TYPE MKVInfo.txt ^| FINDSTR /C:"Track type" /C:"Track number"') DO CALL :FindVideoId %%A
@REM Check if the trackId file was created, if not, skip
IF NOT EXIST videoTrackId.txt GOTO :END
@REM get the videoTrackId from the file and assign it to a variable
FOR /F %%B in (videoTrackId.txt) DO SET trackId=%%B
@REM Extract the video from the mkv
MKVExtract tracks %1 %trackId%:%1.h264
@REM Convert the .h264 to MP4 and give it .mov extention
MP4BOX -add %1.h264 %1.mov -fps 23.976
@REM remove temporary files
@REM if the value of the input equals "video" the previous input was the trackId of the video. Hence the previous input should be saved to file.
IF %1== video type cache.txt >> videoTrackId.txt
ECHO %1 >> cache.txt