batch-file - qBittorrent、FileBot、mkvmerge - 将所有视频文件重新混合到 *.mkv 并删除进程中的字幕

标签 batch-file command-line cmd mkv

我正在尝试执行这个非常有用的批处理,用于处理当前目录和所有子目录中的所有 *.avi、*.mkv 和 *.mp4 文件,并生成 *.mkv 文件(在此过程中删除字幕)并删除原始文件文件

@echo off
for /F "delims=" %%I in ('dir /A-D /B /ON /S *.avi *.mkv *.mp4 2^>nul') do (
    mkvmerge.exe "%%~I" -o "%%~dpI~%%~nI.tmp" --no-subtitles
    if not errorlevel 1 (
        del "%%~I"
        move /Y "%%~dpI~%%~nI.tmp" "%%~dpnI.mkv" >nul
    )
)

与 Filebots AMC脚本(qBittorrent)

filebot -script fn:amc --output "/path/to/media" --action duplicate --conflict skip -non-strict --log-file amc.log --def excludeList=amc.excludes unsorted=y music=y artwork=y "ut_dir=%F" "ut_kind=multi" "ut_title=%N" "ut_label=%L"

与其 --def exec=command 结合使用

--def exec="mkvpropedit {quote f} --edit info --set title={quote object}"

所以我尝试将批处理调整为 qBittorrents 变量并将其命名为 filebot.bat:

mkvmerge.exe "%F" -o "%F.tmp" --no-subtitles
if not errorlevel 1 (
    del "%F"
    move /Y "%F.tmp" "%F.mkv" >nul
)

并相应地调整了AMC脚本

filebot -script fn:amc --output "D:\Desktop\filebot\test2" --action duplicate --conflict skip -non-strict --log-file amc.log --def excludeList=amc.excludes unsorted=n music=y artwork=n "ut_dir=D:\Desktop\filebot\test1\test.avi" "ut_kind=multi" --def exec="D:\Desktop\filebot\test3\filebot.bat {quote f}"

AMC 的工作方式与应有的方式相同,但是当触发 --def exec 命令时,会发生这种情况:

C:\Users\Admin>mkvmerge.exe "F.tmp" --no-subtitles
mkvmerge v13.0.0 ('The Juggler') 64bit
Error: no destination file name was given.

mkvmerge -o out [global options] [options1] <file1> [@option-file.json] …

我猜这与 qBittorrent 变量“%F”有关。 我真的非常感谢一些帮助!

编辑:我删除了批处理中的其他所有内容并将其调整为

mkvmerge.exe "%~1" -o "%~dpn1.tmp" --no-subtitles && >NUL move /Y "%~dpn1.tmp" "%~n1.mkv"

这是 AMC 正常工作后 ​​cmd 所说的内容:

C:\Users\Admin>mkvmerge.exe "D:\Desktop\filebot\test2\TV Shows\StartUp (2016)\Season 01\StartUp (2016) - S01E01 - Seed Money.avi" -o "D:\Desktop\filebot\test2\TV Shows\StartUp (2016)\Season 01\StartUp (2016) - S01E01 - Seed Money.tmp" --no-subtitles   && move /Y "D:\Desktop\filebot\test2\TV Shows\StartUp (2016)\Season 01\StartUp (2016) - S01E01 - Seed Money.tmp" "StartUp (2016) - S01E01 - Seed Money.mkv" 1>NUL
mkvmerge v13.0.0 ('The Juggler') 64bit
'D:\Desktop\filebot\test2\TV Shows\StartUp (2016)\Season 01\StartUp (2016) - S01E01 - Seed Money.avi': Using the demultiplexer for the format 'Matroska'.
'D:\Desktop\filebot\test2\TV Shows\StartUp (2016)\Season 01\StartUp (2016) - S01E01 - Seed Money.avi' track 0: Using the output module for the format 'AVC/h.264'.
'D:\Desktop\filebot\test2\TV Shows\StartUp (2016)\Season 01\StartUp (2016) - S01E01 - Seed Money.avi' track 1: Using the output module for the format 'AAC'.
'D:\Desktop\filebot\test2\TV Shows\StartUp (2016)\Season 01\StartUp (2016) - S01E01 - Seed Money.avi' track 2: Using the output module for the format 'text subtitles'.
'D:\Desktop\filebot\test2\TV Shows\StartUp (2016)\Season 01\StartUp (2016) - S01E01 - Seed Money.avi' track 3: Using the output module for the format 'text subtitles'.
The file 'D:\Desktop\filebot\test2\TV Shows\StartUp (2016)\Season 01\StartUp (2016) - S01E01 - Seed Money.tmp' has been opened for writing.
Progress: 100%
The cue entries (the index) are being written...
Multiplexing took 6 seconds.
Done ?(?????)?

该文件仍然是 .avi,并且仍然有字幕。

最佳答案

AMC 脚本使用 --def exec="path\to\filebot.bat {quote f}" 触发 .bat 脚本,对吗?我认为问题在于,在 filebot.bat 中,命令行参数应读取为 "%~1",而不是 %F .

mkvmerge.exe -S "%~1" -o "%~dpn1.tmp" && >NUL move /Y "%~dpn1.tmp" "%~dpn1.mkv"

我认为应该这样做。顺便说一句,&& 会取代 if not errorlevel 1%~dpn1 表示参数 1 的驱动器、路径、基本名称。

关于batch-file - qBittorrent、FileBot、mkvmerge - 将所有视频文件重新混合到 *.mkv 并删除进程中的字幕,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/45267259/

相关文章:

windows - 从 HTA 中启动批处理文件

macos - 是否有任何命令以纳秒为单位显示 Apple 文件系统 (APFS) 时间戳?

ruby - 请解释 ruby​​ ARGF 行为

ios - 使用 Xcode 的命令行构建工具存档 (xcodebuild archive)

cmd - 在包含不同字符的文件中写入整个cmd命令,例如 ">"或 ">>"

c++ - Nodejs C++ 控制台应用程序

batch-file - 为什么我不能使用 gcloud 的批处理文件连续运行 2 个命令

mysql - 如何使用批处理脚本将.txt 文件中的数据放入 mysql 数据库?

batch-file - 从单个批处理文件运行多个批处理文件

command-line - 使用单个命令移动和重命名文件