將 CustomCommandCritical=true 設定為真不應該會導致程序失敗嗎?我在設定檔中設定了它,並且勾選了「strict」(嚴格),但它只是忽略了腳本返回的 1 值並繼續處理檔案。
這是我目前使用的最新設定檔,我使用的是 MCEBuddy 2.5 Beta 6。
[Move Movie Only]
Description=僅複製
order=copy
copy-ext=.ts
copy-remuxto=.mkv
copy-audiodelay=skip
ffmpeg-VideoOptimized=true
ffmpeg-AudioOptimized=true
copy-VideoOptimized=true
copy-AudioOptimized=true
CustomCommandPath=C:\Windows\System32\WindowsPowerShell\v1.0\powershell.exe
CustomCommandParameters= -File “e:\plex\convertHdr10+ToAV1.ps1” -InputFile “%sourcefile%”
CustomCommandHangPeriod=0
CustomCommandCritical=true
CustomCommandUISession=true
Thanks for providing that information, Dan.
It’s interesting that even with CustomCommandCritical=true and MCEBuddy 2.5 Beta 6, it’s still not failing. The Move Movie Only profile seems straightforward.
Could you also provide the contents of your convertHdr10+ToAV1.ps1 script, specifically how it’s returning the error code? I want to ensure the PowerShell script is indeed returning a non-zero exit code in a way that MCEBuddy can interpret.
For example, in PowerShell, you might use exit 1 to return an error. If the script is ending without an explicit exit command, it might be implicitly returning 0.
以下是日誌文件中一些相關資訊:
2025-08-23T11:07:27 MCEBuddy.AppWrapper.Base --=> 清理摘要:移除了 0 個,失敗 0 個
2025-08-23T11:07:27 MCEBuddy.AppWrapper.Base --=> 正在清理已解壓縮的字幕檔案…
2025-08-23T11:07:27 MCEBuddy.AppWrapper.Base --=> 移除了目前的實例標記:W:\Temp\VideoProcessing_Instances\convertHdr10+ToAV1.52988.marker
2025-08-23T11:07:27 MCEBuddy.AppWrapper.Base --=> 清理處理常式已取消註冊
–=> 程序以代碼 1 退出
2025-08-23T11:07:30 MCEBuddy.Engine.ConversionJob --=> 完成自訂命令,檔案大小 [KB] 62,040,758.00
INFORMATION=> 2025-08-23T11:07:30 MCEBuddy.Engine.ConversionJob --=> 將轉換後的檔案移至目的地
您可以附上完整的轉換日誌嗎?日誌中有些訊息我看不出來是來自 MCEBuddy,您能確認它們是來自您的腳本嗎?
如果您能分享您的腳本,那就太好了,這樣我們就可以複製您的設定並查看發生了什麼事。
我的当前脚本简直是个怪物。
它是我的一个副项目,旨在修复 Plex 的各种问题。它已经发展到大约 5k 行代码,但它确实解决了黑屏问题、杜比视界(Dolby Vision)问题、10 秒启动延迟问题以及重新缓冲问题。![]()
我找到了一个变通方法,可以手动将文件移动到我的失败文件夹。Plex 检测到文件丢失后,就会将其标记为失败。
我删除了之前失败运行的日志。在下一次失败的运行时,我会再次附上日志。我确实看到我脚本中的所有输出都显示在日志中,带有“mcebuddy.appwrapper.base”。
2025-08-24T07:14:53 MCEBuddy.AppWrapper.Base → Plex 优化已启用:
2025-08-24T07:14:53 MCEBuddy.AppWrapper.Base → 带快速启动的分段 MP4
2025-08-24T07:14:53 MCEBuddy.AppWrapper.Base → 2 秒关键帧间隔,实现平滑寻道
2025-08-24T07:14:53 MCEBuddy.AppWrapper.Base → 保守的 HEVC 级别以确保设备兼容性
2025-08-24T07:14:53 MCEBuddy.AppWrapper.Base → SRT 字幕转换以提高兼容性
2025-08-24T07:14:53 MCEBuddy.AppWrapper.Base → 保留 HDR 元数据以用于 4K HDR 内容
2025-08-24T07:14:53 MCEBuddy.AppWrapper.Base → 音轨:选择最佳音轨
2025-08-24T07:14:53 MCEBuddy.AppWrapper.Base → 字幕轨:0 个需要转换,0 个需要复制,3 个被忽略
2025-08-24T07:14:53 MCEBuddy.AppWrapper.Base → 扫描外部字幕文件…
2025-08-24T07:14:53 MCEBuddy.AppWrapper.Base → 未找到外部英文字幕文件
这是我脚本的相关部分:
} catch {
Write-Error "处理失败: $\\_"
Write-Error "堆栈跟踪: $($\\_.ScriptStackTrace)"
\# --- 新逻辑开始 ---
\# 将失败的输入文件移动到指定的文件夹
try {
if (-not (Test-Path $FailedFolder)) {
New-Item -Path $FailedFolder -ItemType Directory -Force | Out-Null
Write-Host "在 '$FailedFolder' 创建了失败文件夹" -ForegroundColor Yellow
}
$destinationPath = Join-Path $FailedFolder (Split-Path $InputFile -Leaf)
Move-Item -Path $InputFile -Destination $destinationPath -Force
Write-Host "已将失败文件 '$InputFile' 移动到 '$destinationPath'" -ForegroundColor Red
} catch {
Write-Error "无法将文件移动到失败文件夹: $\\_"
}
\# --- 新逻辑结束 ---
\# 确保在发生错误时进行清理
if ($spaceMonitorJob) { Stop-SpaceMonitoringWithCleanup -MonitorJob $spaceMonitorJob }
Stop-ActiveProcesses
Clear-TempFiles
Clear-ExtractedSubtitles
exit 1
} finally {
\# 最终清理 - 已修复为使用改进的清理函数
if ($spaceMonitorJob) { Stop-SpaceMonitoringWithCleanup -MonitorJob $spaceMonitorJob }
Stop-ActiveProcesses
Clear-TempFiles
Clear-ExtractedSubtitles
Remove-CurrentInstanceMarker
\# 清除任何剩余的进度指示器
$progressActivities = @("视频处理", "视频编码", "提取 HDR10+ 元数据",
"注入 HDR10+ 元数据", "MP4 容器化", "最终 MKV 重封装", "质量验证")
foreach ($activity in $progressActivities) {
Write-Progress -Activity $activity -Completed
}
\# 取消注册事件处理程序
if ($Script:CleanupRegistered) {
try {
Get-EventSubscriber | Where-Object { $\\_.SourceIdentifier -match "PowerShell.Exiting|ProcessExit" } | Unregister-Event -ErrorAction SilentlyContinue
Write-Host "清理处理程序已取消注册" -ForegroundColor Gray
}
catch {
\# 在关机期间忽略清理错误
}
}
}
Write-Host “处理成功完成!” -ForegroundColor Green
exit 0
这里是一个运行惨败的日志,原因是我的脚本中存在一个编码问题。但这确实表明脚本失败了,而 mcebuddy(mcebuddy)仍在继续运行。
我看到了问题,您的配置文件中没有指示自定义命令检查退出代码:
2025-08-24T10:54:25 MCEBuddy.Transcode.CustomCommand → 准备使用以下参数运行自定义命令:
PreCustomCommandPath = c:\\windows\\system32\\windowspowershell\\v1.0\\powershell.exe
PreCustomCommandParameters = -File “e:\\plex\\convertHdr10+ToAV1.ps1” -InputFile “E:\\Radarr\\Guardians of the Galaxy (2014)\\Guardians of the Galaxy (2014).mkv”
PreCustomCommandHangPeriod = 0
PreCustomCommandCritical = True
PreCustomCommandUISession = True
PreCustomCommandShowWindow = True
PreCustomCommandExitCodeCheck = False
如果您希望 MCEBuddy 查看退出代码,则需要在配置文件中将CustomCommandExitCodeCheck设置为true。CustomCommandCritical只检查进程本身是否终止和出现问题,而不检查返回码或退出代码。
根据自定义命令文档:MCEBuddy - Advanced Settings, Commands and Tweaking
CustomCommandCritical,当此项设置为 true 时,如果自定义命令无效或进程终止(由于挂起检测),MCEBuddy 将使整个转换失败。如果设置为 false,则 MCEBuddy 将继续进行转换处理,而不考虑自定义命令的失败/成功,除非转换后的文件已被重命名或删除。默认值为 false。
CustomCommandExitCodeCheck(v2.4.1+) 如果设置为 true,则 MCEBuddy 将检查自定义命令应用程序的退出代码。如果返回代码为 0(默认值),则视为成功;如果不是 0(正数或负数),则视为失败。如果退出代码失败,MCEBuddy 将停止进一步处理并使转换失败。
謝謝!我可能當時在睡覺或看舊資訊,但我完全錯過了。