Is there a way I can remove subtitle data from an .mkv?
Best Answer
Use MkvToolNix. The mkvmerge tool can do exactly what you want. It's a very capable Matroska manipulator and should be able to remove any kind of stream from an MKV without recoding all the other streams.
On Windows, download the latest version from here. Just run the installer.
On Linux, you can find the package mkvtoolnix in your repository, or alternatively download them from the homepage.
On OS X, the easiest way would be to install mkvtoolnix through Homebrew.
I think one of these commands will do what you want:
# assume input.mkv has 3 subtitle tracks
# remove subtitle track 2 (copy 1&3) from input.mkv & save to output.mkv
mkvmerge -o output.mkv --subtitle-tracks 1,3 input.mkv
# remove all subtitles (copy none)
mkvmerge -o output.mkv --no-subtitles input.mkv
I thought I had tried most subtitle editors, but apparently I missed a fantastic one called Subtitle Edit. There's a command specifically to "Remove text for hearing impaired".
Save the following as something like DelMKVSubs.bat in the same directory mkvmerge.exe is in, edit the rootfolder variable as per your requirements and run the batch file:
@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 -i "%%a" ^| find /c /i "subtitles"') do (
if [%%b]==[0] (
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.
)
)
)
The batch file should be easy enough to understand, but here's an overview nevertheless:
It uses for /r to recursively search %rootfolder% for all MKVs
It then runs mkvmerge -i on each MKV to check whether a subtitle track exists
If the MKV does contain subtitle tracks, it runs mkvmerge -S to remux the file while skipping all such tracks
Finally it checks the exit code of mkvmerge and if this (i.e. errorlevel) is 0 indicating success with no warnings/errors, it deletes the original file
For more see the mkvmerge documentation and also for /?, if /? etc. at the command prompt.
Best Answer
Use MkvToolNix. The
mkvmerge
tool can do exactly what you want. It's a very capable Matroska manipulator and should be able to remove any kind of stream from an MKV without recoding all the other streams.mkvtoolnix
in your repository, or alternatively download them from the homepage.mkvtoolnix
through Homebrew.I think one of these commands will do what you want: