好的,所以我尝试进行批处理视频处理,我想将其压缩为单个批处理文件而不是 5,但我无法将变量传递给内部函数,就像我将它们传递给外部 .bat 文件一样.
这是我的“一体式”版本
mkdir new
mkdir new\fonts
forfiles /M *.mkv /C "cmd /c call :mkvextract @file @fname" >> log.txt 2>&1
forfiles /M *.mkv /C "cmd /c call :mkvmerge @file" >> merge.txt 2>&1
forfiles /M *.mkv /C "cmd /c call :makeavs @file @fname" >> log.txt 2>&1
forfiles /M *.mkv /C "cmd /c call :getfonts @file @fname" >> fonts.txt 2>&1
forfiles /M *.ttf /C "cmd /c call :movefonts @file" >> fonts.txt 2>&1
forfiles /M *.TTF /C "cmd /c call :movefonts @file" >> fonts.txt 2>&1
forfiles /M *.otf /C "cmd /c call :movefonts @file" >> fonts.txt 2>&1
forfiles /M *.OTF /C "cmd /c call :movefonts @file" >> fonts.txt 2>&1
:mkvextract
"C:\Program Files (x86)\MKVToolNix\mkvextract.exe" --ui-language en tracks "%~1" 2:"%CD%\new\%~2_track3_eng.ass"
goto :EOF
:mkvmerge
set mkvorig=%CD%\%~1
set mkvorig=%mkvorig:\=\\%
set mkvnew=%CD%\new\%~1
set mkvnew=%mkvnew:\=\\%
"C:\Program Files (x86)\MKVToolNix\mkvmerge.exe" -o "%mkvnew%" "--language" "0:jpn" "--default-track" "0:yes" "--forced-track" "0:no" "--display-dimensions" "0:1920x1080" "--language" "1:jpn" "--default-track" "1:yes" "--forced-track" "1:no" "-a" "1" "-d" "0" "--no-attachments" "-S" "-T" "--no-global-tags" "--no-chapters" "(" "%mkvorig%" ")" "--track-order" "0:0,0:1"
goto :EOF
:makeavs
echo Directshowsource("new\%~1") >"new\%~2.avs"
echo textsub("new\%~2_track3_eng.ass") >>"new\%~2.avs"
goto :EOF
:getfonts
"C:\Program Files (x86)\MKVToolNix\mkvextract.exe" attachments "%~1" 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20
goto :EOF
:movefonts
move %~1 new\fonts
goto :EOF
“五个.bat文件”版本如下:
mkdir new
mkdir new\fonts
forfiles /M *.mkv /C "cmd /c mkvextract.bat @file @fname" >> log.txt 2>&1
forfiles /M *.mkv /C "cmd /c mkvmerge.bat @file" >> merge.txt 2>&1
forfiles /M *.mkv /C "cmd /c makeavs.bat @file @fname" >> log.txt 2>&1
forfiles /M *.mkv /C "cmd /c getfonts.bat @file @fname" >> fonts.txt 2>&1
forfiles /M *.ttf /C "cmd /c movefonts.bat @file" >> fonts.txt 2>&1
forfiles /M *.TTF /C "cmd /c movefonts.bat @file" >> fonts.txt 2>&1
forfiles /M *.otf /C "cmd /c movefonts.bat @file" >> fonts.txt 2>&1
forfiles /M *.OTF /C "cmd /c movefonts.bat @file" >> fonts.txt 2>&1
我不太确定我是否正确地执行函数调用,但它看起来很正确,因为我在这里找到了:http: //batcheero.blogspot.com/2007/07/function-call-in-batch.html