Last active
January 26, 2023 03:24
-
-
Save ScribbleGhost/9eed21773f37f67ed901617d499e512f to your computer and use it in GitHub Desktop.
Extract all subtitles from MKV video file, and make a copy of the video file without subtitles. Requires mkvmerge and subtitleedit CLI in PATH
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
@echo off | |
FOR %%A IN (*.mkv) DO ( | |
echo %%~nxA | |
FOR /F %%I IN ('mkvmerge -i "%%A" ^| FIND /C "SubRip"') DO (IF %%I GTR 0 (echo SRT found in file) & (subtitleedit /convert "%%A" SubRip) else (echo SRT not found in file)) | |
echo.&echo. | |
FOR /F %%I IN ('mkvmerge -i "%%A" ^| FIND /C "SubStationAlpha"') DO (IF %%I GTR 0 (echo ASS found in file) & (subtitleedit /convert "%%A" SubStationAlpha) else (echo ASS not found in file)) | |
echo.&echo. | |
FOR /F %%I IN ('mkvmerge -i "%%A" ^| FIND /C "VobSub"') DO (IF %%I GTR 0 (echo. &echo. &echo. &echo. & echo VobSub - SUB/IDX found in file. You should use SubtitleEdit to convert the subtitles to a text-based format such as SRT) else (echo VobSub not found in file)) | |
echo.&echo. | |
FOR /F %%I IN ('mkvmerge -i "%%A" ^| FIND /C "subtitles"') DO (IF %%I GTR 0 (rename "%%~nxA" old-"%%~nxA") & (mkvmerge -o "%%A" --no-subtitles "old-%%A")) | |
) | |
pause |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Alternatively, instead of using mkvmerge.exe in the last line you could also use: