【问题标题】:qBittorent, FileBot, mkvmerge - remux all video files to *.mkv and remove subtitles in processqBittorent、FileBot、mkvmerge - 将所有视频文件重新混合到 *.mkv 并删除正在处理的字幕
【发布时间】:2017-07-23 16:17:49
【问题描述】:

我正在尝试执行这个非常有用的批处理来处理当前目录和所有子目录中的所有 *.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"

这是 cmd 在 AMC 已经正常工作后所说的:

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,并且仍然有字幕。

【问题讨论】:

    标签: batch-file command-line cmd mkv


    【解决方案1】:

    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"
    

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

    【讨论】:

    • 在末尾添加一个pause,以便您可以检查mkvmerge 的输出。如果没有别的,你有ffmpeg吗?您可以尝试ffmpeg -i "%~1" -map 0:v -map -0:a -c:v copy -c:a copy "%~dpn1.mkv" 作为替代方案。
    • @Liche1992 它会与您指定的任何流重新混合。只要您只指定视频和音频流,它们就是它将重新混合的流——连同它们相关的元数据,以及全局容器的元数据(标题、章节列表等)。我上面评论的命令将创建一个新的 Matroska 文件,其中包含旧文件中最重要的视频和音频流。如果您的原始文件有多个音频流,它只会复制具有最多通道或最高比特率的一个。如果多个流满足该条件,它会复制第一个出现的流。
    • @Liche1992 您可以编辑您的问题并添加您尝试过的内容以及生成的日志结果。如果相关日志信息过长,您可以发布一个指向 pastebin 粘贴的链接。
    • @Liche1992 抱歉,我在0:a 之间添加了一个额外的破折号字符。应该是ffmpeg -i "%~1" -map 0:v -map 0:a -c:v copy -c:a copy "%~dpn1.mkv"
    • @Liche1992 根据mkvmerge documentation,选项的顺序很重要。 -S--no-subtitles 必须在 输入文件名之前。我编辑了我的答案以反映这一点。
    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2020-11-10
    • 1970-01-01
    • 1970-01-01
    • 2011-06-07
    • 2020-10-09
    • 1970-01-01
    相关资源
    最近更新 更多