请求类型:
新功能
问题或建议摘要:
在通过 MCEBuddy 处理视频之前,我会确保将 SRT 文件命名为 Plex 支持的“强制”和“SDH”格式(https://support.plex.tv/articles/200471133-adding-local-subtitles-to-your-media/)。
我希望 MCEBuddy 能根据文件名的前半部分找到匹配的 SRT 文件进行处理,并在输出时保留这些命名。
例如:
如果原始文件如下
Title.mp4
Title.eng.srt
Title.eng.cc.srt
Title.eng.forced.srt
则输出应为
Title (2021).mkv
Title (2021).eng.srt
Title (2021).eng.cc.srt
Title (2021).eng.forced.srt
有機會能盡快加入這個功能嗎?處理完還得手動重新命名這些 srt 檔案,實在很麻煩。
INFORMATION> 2021-10-30T13:06:27 MCEBuddy.Engine.ConversionJob --> Found SRT file, moving to destination SRT:D:\Temp\working0\Cowboy Bebop - S01E17 - Mushroom Samba.eng.forced.srt Destination:\\NAS\Video\TV\Cowboy Bebop (1998)\Season 01\Cowboy Bebop - S01E17 - Mushroom Samba.eng.srt
2021-10-30T13:06:27 MCEBuddy.Engine.ConversionJob --> Subtitle file \\NAS\Video\TV\Cowboy Bebop (1998)\Season 01\Cowboy Bebop - S01E17 - Mushroom Samba.eng.srt exists, creating a new unique SRT filename
INFORMATION> 2021-10-30T13:06:27 MCEBuddy.Engine.ConversionJob --> Found SRT file, moving to destination SRT:D:\Temp\working0\Cowboy Bebop - S01E17 - Mushroom Samba.eng.srt Destination:\\NAS\Video\TV\Cowboy Bebop (1998)\Season 01\Cowboy Bebop - S01E17 - Mushroom Samba.eng0.srt
(符合標題).(2 或 3 字母語言碼)(.cc 或 .sdh 或 .forced).srt
謝謝
我也非常期待并欢迎这个功能!!!
我在 Plex 服务器上有许多抓取文件,包含三组字幕:
.eng.
.eng.sdh.
.eng.forced
虽然通过手动将所有外部 srt 文件重命名为 MCEBuddy 生成的视频文件名可以暂时解决,但它仍无法将这些额外字幕合并进视频(.mkv)。
最后也是最重要的一点,上述方案仅在“复制”(使用 Unprocessed 配置)时才有效。其他会裁剪片头的配置会导致 MCEBuddy 生成的视频文件与字幕时间轴不再匹配。
我在 GitHub 上找到一个应用,可先把外部 srt 合并进 mkv,再由 MCEBuddy 统一处理,但该工具不会保留 srt 命名,仅按 01、02、03 插入。Mkvtoolnix Batch Tool
或者,MCEBuddy 能否(至少)对额外的 srt 文件进行裁剪、重命名并移动到输出文件夹,同时保留 .eng.forced.srt 的命名?
由于我不再手动修剪文件,我写了一个 PowerShell Core 脚本,并将其作为 PreCustomCommand 执行。我会把源路径、源文件名、目标路径和目标文件名作为参数传入。脚本会复制任何与源视频文件匹配的 srt 或 vtt 字幕文件,将其重命名为最终视频文件名(不含扩展名),并保留语言代码(不过如果原语言是 en-US 或 en,我会改成 eng),以及类型(如果有的话)。
我选择把它放在 PreCustomCommand 阶段,因为此时 MCEBuddy 的正常流程尚未开始查找字幕文件,但已经拥有了重命名或自定义重命名所需的元数据。
该过程采用“复制”而非“移动”,以便验证字幕文件是否已正确到达目标路径;确认无误后,再删除源字幕文件。
profile.config:
PreCustomCommandPath="C:\Program Files\PowerShell\7\pwsh.exe"
PreCustomCommandParameters="\\NAS\Video\Temp\Subtitle-Copy.ps1" -SourcePath "%originalfilepath%" -SourceFileBaseName "%originalfilename%" -DestinationPath "%destinationpath%" -DestinationFileBaseName "%convertedfilename%"
PreCustomCommandPeriod=0
PreCustomCommandCritical=false
PreCustomCommandUiSession=false
PreCustomCommandUiSession=false
PreCustomCommandShowWindows=false
PreCustomCommandExitCodeCheck=false
Subtitle-Copy.ps1:
[CmdletBinding()]
Param(
[Parameter(Mandatory = $true)]
[string]$SourcePath,
[Parameter(Mandatory = $true)]
[string]$SourceFileBaseName,
[Parameter(Mandatory = $true)]
[string]$DestinationPath,
[Parameter(Mandatory = $true)]
[string]$DestinationFileBaseName
)
try {
$subtitleFileSuffix = ''
$subtitleFiles = Get-ChildItem -Path $SourcePath -Filter "$($SourceFileBaseName)*" | Where-Object Extension -Match '\.(vtt|srt)'
if ($subtitleFiles) {
foreach ($subtitleFile in $subtitleFiles) {
Write-Host "Subtitle File: $($subtitleFile.Name)"
$subtitleFileSuffix = $subtitleFile.Name -replace "$([Regex]::Escape($SourceFileBaseName))\.(en-US|en)", '.eng'
Write-Host "Subtitle File Suffix: $subtitleFileSuffix"
if (!(Test-Path -Path $DestinationPath)) {
Write-Host "Create Destination Directory: $DestinationPath"
New-Item $DestinationPath -Type Directory | Out-Null
}
Write-Host "Copy $($subtitleFile.FullName) to $($DestinationPath)\$($DestinationFileBaseName)$($subtitleFileSuffix)"
Copy-Item -Path $subtitleFile.FullName -Destination "$($DestinationPath)\$($DestinationFileBaseName)$($subtitleFileSuffix)" -Force
$copyVerify = Test-Path -Path "$($DestinationPath)\$($DestinationFileBaseName)$($subtitleFileSuffix)"
if ($copyVerify) {
Write-Host "Delete $($subtitleFile.FullName)"
Remove-Item -Path $subtitleFile.FullName -Force
} else {
Write-Host "Unable to verify $($subtitleFile.FullName) was copied to $($DestinationPath)\$($DestinationFileBaseName)$($subtitleFileSuffix)."
}
}
} else {
Write-Host 'No subtitle files found that match $($SourcePath)\$($SourceFileBaseName)* with extension srt or vtt.'
}
} catch {
$error[0]
}
Goose
(Goose)
5
此功能已添加到今天的 2.5.7 测试版中。它应该能够检测 SRT 文件名中的限定词,并在目标 SRT 文件名中保留它们。
试试看,并告诉我们效果如何。
正在下载更新的测试版!谢谢!!!
上述功能是否会添加到今天的 MCEBuddy Beta 中,以修剪额外的 eng.xxx.srt 文件,并将其重命名并复制到目标位置?
Goose
(Goose)
7
MCEBuddy 會在轉檔時同步調整 srt。舉例來說,如果轉檔後的影片剪掉了前 60 秒,它也會從 srt 中剪掉對應內容;如果轉檔時移除了某些廣告段落,它也會更新 srt 檔案,把這些段落一併刪除。