@echo off cls set rootfolder=C:\ echo Enumerating all MKVs under %rootfolder% echo. for /r %rootfolder% %%a in (*.mkv) do ( for /f %%b in ('mkvmerge --identify-verbose "%%a" ^| find /c /i "subtitles"') do ( if [%%b]== ( echo "%%a" has no subtitles ) else ( echo. echo "%%a" has subtitles mkvmerge -q -o "%%~dpna (No Subs)%%~xa" -S "%%a" if errorlevel 1 ( echo Warnings/errors generated during remuxing, original file not deleted ) else ( del /f "%%a" echo Successfully remuxed to "%%~dpna (No Subs)%%~xa", original file deleted ) echo. ) ) )
Which finds all MKV files recursively from a specified path, and removes all subtitles from the MKV files found (if the MKV found contains subtitles), finally deleting all the original MKV files that had the subtitles removed.
I'm looking to add when it runs
mkvmerge -i if has English subtitles, tell it to extract them to the directory of the MKV file before remuxing (using mkvextract).