이것은 당신이 쫓는 일을해야합니다. "mkvmerger.bat"로 저장하고 mkvmerge.exe와 함께 경로에 저장하십시오.
나는 원래 ffmpeg와 매우 비슷한 것을하기 위해 이것을 썼습니다. 기본적으로 소수의 특정 파일 형식 (avi, m4v, mkv, mp4, mpeg, mpegts, mpg)의 파일을 찾아 mkvmerger로 다시 전달한 다음 기본 이름은 같지만 특정 확장자 (srt, idx)는 다른 파일을 확인합니다 , sub, ogg, mp3, aac)를 입력 한 다음 인수 목록에 추가합니다. 그런 다음 실제로 작업을 수행하기 위해 mkvmerge로 전달됩니다. 나는 mkvmerge를 사용하지 않으므로 idx와 sub를 모두 전달 해야하는지 알 수 없으므로 그대로 시도하고 문제가있는 경우 하나만 사용하십시오 (잘못된 행을 제거하십시오) ).
@ECHO OFF
::'===========================================================
:: mkvmerger.bat
:: mkvmerge recipe.
::
:: Written by Shawn K. Hall
::
::'===========================================================
::setlocal enableDelayedExpansion
::'===========================================================
where /q mkvmerge.exe
IF NOT "%errorlevel%"=="0" GOTO nomkvmerge
::'===========================================================
::'===========================================================
:input
::'===========================================================
:: defaults
IF "%mkvTargetDir%"=="" SET mkvTargetDir=Done\
IF "%~1"=="" GOTO all
GOTO next
::'===========================================================
::'===========================================================
:next
IF /I "%~1"=="*" SHIFT&&GOTO all
IF /I "%~1"=="all" SHIFT&&GOTO all
IF /I "%~1"=="" GOTO done
SET inparam=%~1
IF "%~1"=="" GOTO none
SET "inparam2=%inparam:^*=%"
IF NOT "%inparam2%"=="%inparam%" SHIFT&&GOTO many
SET inparam2=
GOTO process
::'===========================================================
::'===========================================================
:all
FOR %%x IN ("avi" "m4v" "mkv" "mp4" "mpeg" "mpegts" "mpg") DO (
IF EXIST *.%%x FORFILES /M *.%%x /c "cmd /c CALL mkvmerger.bat ^"@file^""
)
GOTO next
::'===========================================================
::'===========================================================
:many
IF EXIST "%inparam%" FORFILES /M %inparam% /c "cmd /c CALL mkvmerger.bat ^"@file^""
GOTO next
::'===========================================================
::'===========================================================
:destexists
ECHO. The destination file already exists:
ECHO. "%mkvTarget%"
ECHO. Are you sure you haven't already processed this file^?
ECHO.
GOTO done
::'===========================================================
::'===========================================================
:none
ECHO. Error: You must pass the source video file or "^*" as an argument.
ECHO.
GOTO done
::'===========================================================
::'===========================================================
:nomkvmerge
ECHO. Error: mkvmerge is either not installed or is not in the path.
ECHO.
GOTO done
::'===========================================================
::'===========================================================
:process
SET "mkvSources=%~1"
SET mkvTarget=
SET "mkvTargetName=%~n1"
SET mkvTargetExt=.mkv
SET "mkvTarget=%mkvTargetDir%\%mkvTargetName%%mkvTargetExt%"
IF EXIST "%mkvTarget%" GOTO destexists
IF NOT EXIST "%mkvTargetDir%" MKDIR "%mkvTargetDir%"
ECHO.
ECHO.Starting with "%mkvTarget%"
:processing
IF EXIST "%mkvTargetName%.srt" SET "mkvSources=%mkvSources% %mkvTargetName%.srt"
IF EXIST "%mkvTargetName%.idx" SET "mkvSources=%mkvSources% %mkvTargetName%.idx"
IF EXIST "%mkvTargetName%.ogg" SET "mkvSources=%mkvSources% %mkvTargetName%.ogg"
IF EXIST "%mkvTargetName%.mp3" SET "mkvSources=%mkvSources% %mkvTargetName%.mp3"
IF EXIST "%mkvTargetName%.aac" SET "mkvSources=%mkvSources% %mkvTargetName%.aac"
mkvmerge.exe -o "%mkvTarget%" %mkvSources%
:processingDone
ECHO.Done with "%mkvTarget%"
ECHO.
GOTO done
::'===========================================================
::'===========================================================
:done