Windows - 是否可以使用 MKV 合并删除所有与给定名称不匹配的字幕

Windows - 是否可以使用 MKV 合并删除所有与给定名称不匹配的字幕

我找到了这个代码:

:: remux all mkvs under a certain subfolder with all subitles
:: but those as specified by %language% parameter removed.

@echo off
setlocal enabledelayedexpansion

:: set your variables here
set rootfolder="C:\temp\New folder"
set language=eng
set suffix= (eng sub)

:: do the remuxing
echo Remuxing all mkvs in %rootfolder% and its subfolders.
for /r %rootfolder% %%a in (*.mkv) do (
    set subs=
    set mkv=%%a
    for /f "tokens=3 delims=: " %%b in ('mkvmerge -I "%%a" ^| findstr /i /r 
".*subtitles.*language:%language%.*"') do (
        set subs=!subs!,%%b
    )
    for /f "tokens=*delims=," %%c in ("!subs!") do (
        set subs=%%c
    )
    if not exist "%%~dpna%suffix%%%~xa" if not "!subs!"=="" (
        mkvmerge -q -o "%%~dpna%suffix%%%~xa" -s !subs! "%%a"
        if errorlevel 1 (
            echo Warnings/errors generated during remuxing of "%%a".
        ) else (
            echo Successfully remuxed to "%%~dpna (eng subs)%%~xa".
        )
    ) else (
        echo Input file "%%a" has no subtitles in %language% or output file 
"%%~dpna%suffix%%%~xa" already exists. Skipping this file.
    )
)
pause

是否可以重新编写此代码以采用字幕名称而不是语言?
在此处找到代码:https://superuser.com/a/762617/1089631

相关内容