21 コミット
作成者 SHA1 メッセージ 日付
routersys c55532bbc8 Gitea Actions のワークフローを直す 2026-11-08 13:06:08 +09:00
routersys 813ecc2ebf Gitea Actions のワークフローを直す 2026-11-08 10:15:34 +09:00
routersys e42bf6efb0 Gitea Actions のワークフローを直す 2026-11-08 09:48:33 +09:00
routersys a2b2c4a3e7 過去のタグ用ワークフローを消す 2026-11-08 03:58:00 +09:00
routersys 59bb186882 Gitea Actions のワークフローを直す 2026-11-08 03:56:06 +09:00
routersys c80d0b343b Gitea Actions の過去のタグ用ワークフローを足す 2026-11-08 01:34:38 +09:00
routersys 073062f451 Gitea Actions の過去のタグ用ワークフローを足す 2026-11-08 01:07:07 +09:00
routersys fdef6e46b9 Gitea Actions の過去のタグ用ワークフローを足す 2026-11-07 22:36:18 +09:00
routersys dd581157ed Gitea Actions のワークフローを直す 2026-11-07 22:08:17 +09:00
routersys d525b5be83 Gitea Actions のワークフローを足す 2026-11-07 19:53:18 +09:00
routersys 7d8d84badd 画像の参照先をGiteaへ移す 2026-11-07 18:21:56 +09:00
routersys 81dcbde936 サブモジュールの参照先をGiteaへ移す 2026-11-07 18:18:27 +09:00
routersys 7ab5e9b6f7 不具合の報告の説明を送信の上限と項目と再送へ合わせる 2026-11-02 11:35:44 +09:00
routersys 85451eb49a バージョンをv2.0.2へ上げる
リリース / build-and-release (workflow_dispatch) Actions がタグ v2.0.2 のコミットから作成しました
2026-09-21 12:54:34 +09:00
routersys e2e8caf836 デバイス消失の検知をCOM例外にも広げる 2026-09-21 12:10:02 +09:00
routersys e6f3bc6557 GPUデバイス消失時に再作成して再試行する 2026-09-21 12:04:39 +09:00
routersys ad1d6cdd50 GPUデバイスロストを固有の失敗として扱う 2026-09-21 10:33:33 +09:00
routersys bf6de65f3c バージョンをv2.0.1へ上げる
リリース / build-and-release (workflow_dispatch) Actions がタグ v2.0.1 のコミットから作成しました
2026-09-15 20:32:05 +09:00
routersys 4f2e566ab8 ffmpegが異常終了した時は入力の書き込みの失敗より終了コードを返す 2026-09-15 20:11:02 +09:00
routersys 9352e8e2c3 メインウィンドウと共に閉じた進捗ウィンドウを作り直す 2026-09-15 20:06:40 +09:00
routersys c377663165 フレームの末尾の時刻でチャンクの選択を試験する 2026-09-13 19:51:45 +09:00
13個のファイルの変更、638行の追加、74行の削除

検索条件に一致するファイルはありません

+470
ファイルの表示
@@ -0,0 +1,470 @@
name: リリース
on:
push:
tags:
- 'v*'
workflow_dispatch:
inputs:
tag:
description: リリースするタグ
required: true
permissions:
contents: write
jobs:
build-and-release:
runs-on: windows-latest
steps:
- name: ソースコードのチェックアウト
uses: actions/checkout@v4
env:
GIT_CONFIG_COUNT: "2"
GIT_CONFIG_KEY_0: url.https://git.routersys.com/routersys/.insteadOf
GIT_CONFIG_VALUE_0: https://github.com/routersys/
GIT_CONFIG_KEY_1: url.https://git.routersys.com/manju-summoner/YukkuriMovieMaker.Generator.insteadOf
GIT_CONFIG_VALUE_1: https://github.com/manju-summoner/YukkuriMovieMaker.Generator
with:
ref: ${{ inputs.tag || github.ref_name }}
submodules: recursive
fetch-depth: 0
- name: YMM4 最新リリースの取得と解凍
id: ymm4
shell: pwsh
run: |
$list = 'C:\runner\cache\ymm4\releases.json'
New-Item -ItemType Directory -Force -Path (Split-Path $list) | Out-Null
if (-not (Test-Path $list) -or (Get-Item $list).Length -lt 1000 -or ((Get-Date) - (Get-Item $list).LastWriteTime).TotalHours -gt 6) {
$fetched = $null
for ($attempt = 1; $attempt -le 6 -and -not $fetched; $attempt++) {
try {
$fetched = Invoke-RestMethod -Uri "https://api.github.com/repos/manju-summoner/YukkuriMovieMaker4/releases?per_page=100" `
-Headers @{ "User-Agent" = "ProxyForge-CI" } -ErrorAction Stop
}
catch {
$message = $_.Exception.Message
Write-Host "リリース一覧の取得に失敗しました($attempt 回目): $($message.Substring(0, [Math]::Min(80, $message.Length)))"
Start-Sleep -Seconds (5 * $attempt)
}
}
if (@($fetched).Count -gt 0) {
$fetched | Select-Object tag_name, published_at, prerelease, draft, assets |
ConvertTo-Json -Depth 6 | Set-Content -Path $list -Encoding UTF8
}
elseif (-not (Test-Path $list)) { throw 'the list of releases could not be fetched' }
else { Write-Host '保存済みのリリース一覧を使います' }
}
$when = [DateTimeOffset](git log -1 --format=%cI)
$releases = @(Get-Content -Raw -Path $list | ConvertFrom-Json | Where-Object { -not $_.draft -and -not $_.prerelease })
$release = $releases | Where-Object { [DateTimeOffset]$_.published_at -le $when } | Select-Object -First 1
if (-not $release) { $release = $releases | Select-Object -Last 1 }
Write-Host "最後のコミット $when に合わせた YMM4: $($release.tag_name)"
$asset = $release.assets | Where-Object { $_.name -like "*_Lite.zip" } | Select-Object -First 1
if (-not $asset) {
$asset = $release.assets | Where-Object { $_.name -like "*.zip" } | Select-Object -First 1
}
Write-Host "ダウンロード対象: $($asset.name)"
$cache = Join-Path 'C:\runner\cache\ymm4' $asset.name
$extracted = "$cache.extracted"
$lock = New-Object System.Threading.Mutex($false, 'Global\ci-ymm4-cache')
[void]$lock.WaitOne()
try {
if (-not (Test-Path "$extracted\.complete")) {
New-Item -ItemType Directory -Force -Path (Split-Path $cache) | Out-Null
Invoke-WebRequest -Uri $asset.browser_download_url -OutFile $cache
Remove-Item -Recurse -Force $extracted -ErrorAction SilentlyContinue
Expand-Archive -Path $cache -DestinationPath $extracted -Force
New-Item -ItemType File -Path "$extracted\.complete" | Out-Null
}
else {
Write-Host "保存済みの YMM4 を使います: $extracted"
}
}
finally {
$lock.ReleaseMutex()
}
$ymm4Dir = (Get-ChildItem -Path $extracted -Recurse -Filter "YukkuriMovieMaker.dll" |
Select-Object -First 1).DirectoryName
Write-Host "YMM4 DLL ディレクトリ: $ymm4Dir"
echo "YMM4_DIR=$ymm4Dir\" >> $env:GITHUB_OUTPUT
- name: タグ名からバージョンを取得
id: version
shell: pwsh
run: |
$tag = "${{ inputs.tag || github.ref_name }}"
echo "TAG=$tag" >> $env:GITHUB_OUTPUT
echo "VERSION=$($tag.TrimStart('v'))" >> $env:GITHUB_OUTPUT
- name: バージョン記載の照合
shell: pwsh
run: |
$tag = "${{ steps.version.outputs.TAG }}"
$version = "${{ steps.version.outputs.VERSION }}"
$problems = @()
$csprojPath = "ProxyForge/ProxyForge.csproj"
$csproj = Get-Content $csprojPath -Raw
if (-not $csproj.Contains("<Version>$version</Version>")) {
$current = if ($csproj -match '<Version>([^<]*)</Version>') { $Matches[1] } else { "記載なし" }
$problems += "$csprojPath の <Version> が $current です。$version にしてください。"
}
$readmePath = ".github/Plugin_Readme.txt"
$readme = Get-Content $readmePath -Raw
if (-not $readme.Contains(" ProxyForge for YMM4 $tag")) {
$current = if ($readme -match '(?m)^ ProxyForge for YMM4 (\S+)') { $Matches[1] } else { "記載なし" }
$problems += "$readmePath の見出しが $current です。$tag にしてください。"
}
if ($problems.Count -eq 0) {
Write-Host "バージョン記載は $tag と一致しています"
exit 0
}
foreach ($problem in $problems) {
Write-Host "::error::$problem"
}
Write-Host "::error::リリースの対象は $tag が指すコミットです。タグを付けた後で main へ訂正を積んでも、その訂正はリリースに入りません。タグを削除し、記載を直したコミットを積んでから付け直してください。"
exit 1
- name: プロジェクトのビルド
shell: pwsh
run: |
$proj = "ProxyForge/ProxyForge.csproj"
dotnet build "$proj" `
-c Release `
-p:YMM4DirPath="${{ steps.ymm4.outputs.YMM4_DIR }}" `
-p:SkipPluginDeploy=true
- name: パッケージの作成
id: package
shell: pwsh
run: |
$version = "${{ steps.version.outputs.TAG }}"
$outDir = "ProxyForge/bin/Release/net10.0-windows10.0.19041.0"
$stageRoot = "stage/ProxyForge"
$pkgName = "ProxyForge_$version.ymme"
New-Item -ItemType Directory -Path $stageRoot -Force | Out-Null
$dll = "$outDir/ProxyForge.dll"
if (-not (Test-Path $dll)) {
Write-Error "ビルド結果に ProxyForge.dll が見つかりませんでした: $dll"
exit 1
}
Copy-Item $dll "$stageRoot/"
foreach ($lang in @("ar-sa", "en-us", "es-es", "id-id", "ko-kr", "zh-cn", "zh-tw")) {
$src = "$outDir/$lang"
if (Test-Path $src) {
New-Item -ItemType Directory -Path "$stageRoot/$lang" -Force | Out-Null
Copy-Item "$src/*.dll" "$stageRoot/$lang/"
}
}
Copy-Item ".github/Plugin_Readme.txt" "$stageRoot/Readme.txt"
$readme = Get-Content "$stageRoot/Readme.txt" -Raw
if (-not $readme.Contains(" ProxyForge for YMM4 $version")) {
Write-Error "同梱する Readme.txt の見出しが $version と一致しません"
exit 1
}
Compress-Archive -Path "stage/*" -DestinationPath $pkgName -CompressionLevel Optimal
echo "PKG_NAME=$pkgName" >> $env:GITHUB_OUTPUT
- name: 変更履歴の作成
id: changelog
shell: pwsh
env:
GITEA_TOKEN: ${{ github.token }}
TAG: ${{ steps.version.outputs.TAG }}
REPOSITORY: ${{ github.repository }}
SERVER_URL: ${{ github.server_url }}
PACKAGE: ${{ steps.package.outputs.PKG_NAME }}
run: |
$tag = $env:TAG
$repository = $env:REPOSITORY
$server = $env:SERVER_URL
$code = [char]0x60
$fence = [string]::new($code, 3)
$unit = [char]0x1f
$previous = ""
$candidates = @(git tag --list "v*" --merged $tag --sort=-creatordate | Where-Object { $_ -ne $tag })
if ($candidates.Count -gt 0) {
$previous = $candidates[0]
}
Write-Host "直前のタグ: $previous"
$range = if ($previous) { "$previous..$tag" } else { $tag }
$log = @(git log "--format=%H%x1f%s%x1f%an%x1f%ad" --date=short $range)
$commits = @()
foreach ($line in $log) {
if (-not $line) { continue }
$fields = $line -split $unit
if ($fields.Count -lt 4) { continue }
$commits += [pscustomobject]@{
Sha = $fields[0]
Subject = $fields[1]
Name = $fields[2]
Date = $fields[3]
Login = ""
Avatar = ""
}
}
Write-Host "コミット数: $($commits.Count)"
$pending = [System.Collections.Generic.HashSet[string]]::new()
foreach ($commit in $commits) {
[void]$pending.Add($commit.Sha)
}
$headers = @{ Authorization = "token $env:GITEA_TOKEN" }
$accounts = @{}
$page = 1
while ($pending.Count -gt 0 -and $page -le 20) {
$rows = @()
try {
$rows = @(Invoke-RestMethod -Uri "$server/api/v1/repos/$repository/commits?sha=$tag&limit=50&page=$page&stat=false&verification=false&files=false" -Headers $headers)
}
catch {
Write-Host "コミットの作者を取得できませんでした: $($_.Exception.Message)"
break
}
if ($rows.Count -eq 0) { break }
foreach ($row in $rows) {
if ($pending.Remove($row.sha)) {
$login = ""
$avatar = ""
if ($row.author) {
$login = [string]$row.author.login
$avatar = [string]$row.author.avatar_url
}
$accounts[$row.sha] = @{ Login = $login; Avatar = $avatar }
}
}
if ($rows.Count -lt 50) { break }
$page++
}
foreach ($commit in $commits) {
if ($accounts.ContainsKey($commit.Sha)) {
$commit.Login = $accounts[$commit.Sha].Login
$commit.Avatar = $accounts[$commit.Sha].Avatar
}
}
$emptyTree = "4b825dc642cb6eb9a060e54bf8d69288fbee4904"
$base = if ($previous) { $previous } else { $emptyTree }
$shortstat = (@(git diff --shortstat $base $tag) -join " ")
$changedFiles = 0
$insertions = 0
$deletions = 0
if ($shortstat -match "(\d+) file") { $changedFiles = [int]$Matches[1] }
if ($shortstat -match "(\d+) insertion") { $insertions = [int]$Matches[1] }
if ($shortstat -match "(\d+) deletion") { $deletions = [int]$Matches[1] }
$diffStat = @(git diff --stat $base $tag)
$tagDate = (git log -1 "--format=%ad" --date=short $tag)
$contributors = @($commits |
Group-Object -Property { if ($_.Login) { $_.Login } else { $_.Name } } |
Sort-Object -Property Count -Descending)
function Get-Icon($avatar, $login, $size) {
if (-not $avatar) { return "" }
$sized = if ($avatar.Contains("?")) { "$avatar&s=$($size * 2)" } else { "$avatar" + "?s=$($size * 2)" }
return "<img src=""$sized"" width=""$size"" height=""$size"" alt=""$login""> "
}
$package = Get-Item $env:PACKAGE
$size = [math]::Round($package.Length / 1MB, 2)
$body = [System.Collections.Generic.List[string]]::new()
$body.Add("## 概要")
$body.Add("")
$body.Add("| 項目 | 内容 |")
$body.Add("|---|---|")
$body.Add("| タグ | [$tag]($server/$repository/tree/$tag) |")
$body.Add("| 公開日 | $tagDate |")
if ($previous) {
$body.Add("| 直前のリリース | [$previous]($server/$repository/releases/tag/$previous) |")
}
$body.Add("| コミット数 | $($commits.Count) |")
$body.Add("| 貢献者 | $($contributors.Count) 名 |")
$body.Add("| 変更されたファイル | $changedFiles |")
$body.Add("| 追加された行 | $insertions |")
$body.Add("| 削除された行 | $deletions |")
$body.Add("")
$body.Add("## ダウンロード")
$body.Add("")
$body.Add("| ファイル | サイズ |")
$body.Add("|---|---|")
$body.Add("| $($package.Name) | $size MB |")
$body.Add("")
$body.Add("## 貢献者")
$body.Add("")
$body.Add("| 貢献者 | コミット数 |")
$body.Add("|---|---|")
foreach ($contributor in $contributors) {
$first = $contributor.Group[0]
if ($first.Login) {
$name = (Get-Icon $first.Avatar $first.Login 40) + "[@$($first.Login)]($server/$($first.Login))"
}
else {
$name = $first.Name
}
$body.Add("| $name | $($contributor.Count) |")
}
$body.Add("")
$body.Add("## 変更履歴")
$body.Add("")
$body.Add("| コミット | 内容 | 貢献者 | 日付 |")
$body.Add("|---|---|---|---|")
$maximumCommits = 300
$listed = 0
foreach ($commit in $commits) {
if ($listed -ge $maximumCommits) { break }
$short = $commit.Sha.Substring(0, 7)
$subject = $commit.Subject -replace '\|', '\|'
if ($commit.Login) {
$author = (Get-Icon $commit.Avatar $commit.Login 20) + "[@$($commit.Login)]($server/$($commit.Login))"
}
else {
$author = $commit.Name
}
$body.Add("| [$code$short$code]($server/$repository/commit/$($commit.Sha)) | $subject | $author | $($commit.Date) |")
$listed++
}
if ($commits.Count -gt $maximumCommits) {
$body.Add("")
$body.Add("残り $($commits.Count - $maximumCommits) 件のコミットは省略しました。")
}
if ($diffStat.Count -gt 0) {
$body.Add("")
$body.Add("## 変更されたファイル")
$body.Add("")
$body.Add("<details>")
$body.Add("<summary>差分の統計</summary>")
$body.Add("")
$body.Add($fence)
$maximumStatLines = 200
$shown = 0
foreach ($line in $diffStat) {
if ($shown -ge $maximumStatLines) { break }
$body.Add($line)
$shown++
}
if ($diffStat.Count -gt $maximumStatLines) {
$body.Add("... 残り $($diffStat.Count - $maximumStatLines) 行は省略しました。")
}
$body.Add($fence)
$body.Add("")
$body.Add("</details>")
}
if ($previous) {
$body.Add("")
$body.Add("## 全ての変更")
$body.Add("")
$body.Add("$server/$repository/compare/$previous...$tag")
}
$path = "release-body.md"
Set-Content -Path $path -Value ($body -join "`n") -Encoding utf8NoBOM
if (-not (Test-Path $path)) {
throw "変更履歴を作成できませんでした。"
}
Write-Host "変更履歴の行数: $($body.Count)"
$global:LASTEXITCODE = 0
- name: Gitea リリースの作成
shell: pwsh
env:
GITEA_TOKEN: ${{ github.token }}
REPOSITORY: ${{ github.repository }}
SERVER_URL: ${{ github.server_url }}
EVENT_NAME: ${{ github.event_name }}
WORKFLOW_NAME: ${{ github.workflow }}
JOB_NAME: ${{ github.job }}
RUN_URL: ${{ github.server_url }}/${{ github.repository }}/actions/runs/${{ github.run_number }}
RELEASE_TAG: ${{ inputs.tag || github.ref_name }}
RELEASE_NAME: ${{ steps.version.outputs.TAG }}
RELEASE_BODY: ''
RELEASE_BODY_PATH: release-body.md
RELEASE_DRAFT: false
RELEASE_PRERELEASE: false
RELEASE_FILES: |
${{ steps.package.outputs.PKG_NAME }}
run: |
$headers = @{ Authorization = "token $env:GITEA_TOKEN" }
$api = "$env:SERVER_URL/api/v1/repos/$env:REPOSITORY"
$tag = $env:RELEASE_TAG
$body = $env:RELEASE_BODY
if ($env:RELEASE_BODY_PATH -and (Test-Path $env:RELEASE_BODY_PATH)) {
$body = Get-Content $env:RELEASE_BODY_PATH -Raw -Encoding utf8
}
$files = @()
foreach ($pattern in ($env:RELEASE_FILES -split "[`r`n,]+" | Where-Object { $_.Trim() })) {
$found = @(Get-ChildItem -Path $pattern.Trim() -File -ErrorAction SilentlyContinue)
if ($found.Count -eq 0) { throw "リリースに付けるファイルが見つかりません: $pattern" }
$files += $found
}
$payload = @{
tag_name = $tag
name = $env:RELEASE_NAME
body = [string]$body
draft = ($env:RELEASE_DRAFT -eq 'true')
prerelease = ($env:RELEASE_PRERELEASE -eq 'true')
} | ConvertTo-Json
$bytes = [System.Text.Encoding]::UTF8.GetBytes($payload)
$existing = $null
try { $existing = Invoke-RestMethod -Uri "$api/releases/tags/$([System.Uri]::EscapeDataString($tag))" -Headers $headers } catch { }
if ($existing) {
$release = Invoke-RestMethod -Method Patch -Uri "$api/releases/$($existing.id)" -Headers $headers -ContentType "application/json; charset=utf-8" -Body $bytes
foreach ($asset in @($existing.assets)) {
Invoke-RestMethod -Method Delete -Uri "$api/releases/$($existing.id)/assets/$($asset.id)" -Headers $headers | Out-Null
}
} else {
$release = Invoke-RestMethod -Method Post -Uri "$api/releases" -Headers $headers -ContentType "application/json; charset=utf-8" -Body $bytes
}
foreach ($file in $files) {
$name = [System.Uri]::EscapeDataString($file.Name)
Invoke-RestMethod -Method Post -Uri "$api/releases/$($release.id)/assets?name=$name" -Headers $headers -Form @{ attachment = Get-Item $file.FullName } | Out-Null
Write-Host "添付しました: $($file.Name)"
}
Write-Host "リリースを作成しました: $($release.html_url)"
if ($env:EVENT_NAME -eq 'workflow_dispatch') {
try {
$sha = (git rev-parse HEAD).Trim()
$status = @{
state = 'success'
context = "$env:WORKFLOW_NAME / $env:JOB_NAME (workflow_dispatch)"
description = "Actions がタグ $tag のコミットから作成しました"
target_url = $env:RUN_URL
} | ConvertTo-Json
Invoke-RestMethod -Method Post -Uri "$api/statuses/$sha" -Headers $headers -ContentType "application/json; charset=utf-8" -Body ([System.Text.Encoding]::UTF8.GetBytes($status)) | Out-Null
Write-Host "タグのコミット $sha に成功の状態を付けました"
}
catch {
Write-Warning "タグのコミットに状態を付けられませんでした: $($_.Exception.Message)"
}
}
+15 -5
ファイルの表示
@@ -1,5 +1,5 @@
========================================
ProxyForge for YMM4 v2.0.0
ProxyForge for YMM4 v2.0.2
========================================
YukkuriMovieMaker4(YMM4)上で動作する、編集の間だけ使う解像度の低い
動画ファイルを作り、プレビューでは元の動画の代わりにそれを読み込む
@@ -85,15 +85,22 @@ YukkuriMovieMaker4(YMM4)上で動作する、編集の間だけ使う解像
■ 不具合の報告
--------------------------------------------------------------------------------
本プラグインは、想定していない例外が起きたときに、その内容を開発者へ自動で
送信します。同意は求めず、常に送信します。
送信します。同意は求めません。止める設定もありません。
送信する数には上限があります。YMM4 の 1 回の起動で送る報告は、
YMM4-Telemetry で報告する別のプラグインと合わせて 20 件までです。
例外の型と発生位置が同じ報告は 3 件までです。上限を超えた報告と、
送信先から待つよう求められている間に起きた報告は、送信も退避もしません。
送信する情報は次のとおりです。
例外 : 型の完全名、メッセージ、スタックトレース
発生位置 : モジュール名、関数名、ファイル名、行番号
発生位置 : モジュール名、関数名、ファイル名、行番号、
プラグイン自身のコードかどうか
プラグイン : アセンブリ名、バージョン
実行環境 : OS の名前とバージョン、.NET のバージョン、
CPU のアーキテクチャ、論理プロセッサ数
識別子 : YMM4 の起動ごとに決まるセッション識別子、報告ごとの識別子
時刻 : 報告を作った時刻(UTC)
動画ファイルの中身とプロジェクトの内容は送信しません。継続して個人を追跡
する識別子も持ちません。セッション識別子は YMM4 を起動し直すと別の値に
@@ -113,8 +120,11 @@ YukkuriMovieMaker4(YMM4)上で動作する、編集の間だけ使う解像
キャッシュの読み書きで想定している失敗 : 索引を読めない、ファイルを
消せない、チャンクを開けない
送信できなかった報告は YMM4 のユーザーフォルダーへ退避し、次回の起動時に
送り直します。送信も再送も非同期に行うため、起動と生成が遅くなることは
送信できなかった報告は YMM4 のユーザーフォルダーへ退避します。
次に YMM4 を起動したあと、本プラグインを読み込むか、
同じく YMM4-Telemetry で報告する別のプラグインが動き始めると、
退避した報告を 1 回の起動で 10 件まで送り直します。
送信も再送も非同期に行うため、起動と生成が遅くなることは
ありません。
--------------------------------------------------------------------------------
■ 免責事項
+3 -3
ファイルの表示
@@ -1,9 +1,9 @@
[submodule "YukkuriMovieMaker.Generator"]
path = YukkuriMovieMaker.Generator
url = https://github.com/manju-summoner/YukkuriMovieMaker.Generator
url = https://git.routersys.com/manju-summoner/YukkuriMovieMaker.Generator
[submodule "YMM4-GitHubUpdateNotifier"]
path = YMM4-GitHubUpdateNotifier
url = https://github.com/routersys/YMM4-GitHubUpdateNotifier
url = https://git.routersys.com/routersys/YMM4-GitHubUpdateNotifier
[submodule "YMM4-Telemetry"]
path = YMM4-Telemetry
url = https://github.com/routersys/YMM4-Telemetry
url = https://git.routersys.com/routersys/YMM4-Telemetry
+52
ファイルの表示
@@ -187,6 +187,20 @@ public sealed class ProxyEncoderTests
Assert.False(File.Exists(workspace.OutputPath));
}
[Fact]
public async Task AnOutputThatCannotBeOpenedIsReportedAsAnFFmpegFailure()
{
Ymm4TestEnvironment.Require();
using var workspace = new Workspace();
var encoder = workspace.CreateEncoder(640, 360, 30, 1, 10);
using var session = await encoder.OpenAsync(workspace.Request(50), TestContext.Current.CancellationToken);
var missing = Path.Combine(workspace.Path, "missing", "proxy.mp4");
var exception = await Assert.ThrowsAsync<ProxyEncodeException>(() => session.EncodeAsync(0, 10, missing, null, TestContext.Current.CancellationToken));
Assert.Equal(ProxyEncodeFailure.FFmpegFailed, exception.Failure);
}
[Fact]
public async Task ASoftEdgeIsNotMistakenForTransparency()
{
@@ -474,6 +488,44 @@ public sealed class ProxyEncoderTests
Assert.IsType<IOException>(failure.InnerException);
}
[Fact]
public async Task RunAsyncReportsTheExitOfFFmpegThatStoppedReadingTheInput()
{
Ymm4TestEnvironment.Require();
using var workspace = new Workspace();
var missing = Path.Combine(workspace.Path, "missing", "proxy.mp4");
Exception? failure = null;
var result = await FFmpegProcessRunner.RunAsync(
Ymm4TestEnvironment.FFmpegPath,
arguments =>
{
var request = new FFmpegEncodeRequest(missing, 32, 32, new FrameRate(30, 1), 100_000, 1, SoftwareEncoder);
FFmpegArguments.WriteEncode(arguments, in request);
},
workspace.Path,
(destination, cancellationToken) => Task.Run(() =>
{
var frame = new byte[32 * 32 * 4];
try
{
for (var index = 0; index < 1024; index++)
destination.Write(frame);
}
catch (IOException exception)
{
failure = exception;
throw;
}
}, cancellationToken),
ProcessPriorityClass.BelowNormal,
TestContext.Current.CancellationToken);
Assert.IsType<IOException>(failure);
Assert.False(result.IsSuccess);
Assert.Contains(missing, result.Diagnostics);
}
[Fact]
public async Task RunAsyncRethrowsOtherFailuresOfTheInputWriterUnchanged()
{
+4 -2
ファイルの表示
@@ -203,11 +203,13 @@ public sealed class ProxyVideoSourceTests : IDisposable
var source = CreateSource();
var entry = Register(source, 0, 1, 2);
using var wrapper = CreateWrapper(source, entry, null);
var lastTickOfFrame299 = new FrameRate(30, 1).GetFrameStart(300) - TimeSpan.FromTicks(1);
Assert.Equal(300, FrameTime.TimeToFrame(lastTickOfFrame299, 30, 1));
wrapper.Update(FrameTimeOf(299));
wrapper.Update(lastTickOfFrame299);
Assert.Equal(0, wrapper.ShownChunk);
Assert.Equal(FrameTimeOf(299), chunkSources[0].LastUpdateTime);
Assert.Equal(lastTickOfFrame299, chunkSources[0].LastUpdateTime);
Assert.Equal(299, focus.Get(source));
}
+5 -4
ファイルの表示
@@ -133,12 +133,13 @@ internal static class FFmpegProcessRunner
cancellationToken.ThrowIfCancellationRequested();
if (inputFailure is IOException)
throw new InvalidOperationException(string.Concat("Failed to send frames to FFmpeg. ", diagnostics.ToString()), inputFailure);
if (inputFailure is not null)
var result = new FFmpegProcessResult(process.ExitCode, diagnostics.ToString());
if (inputFailure is IOException && result.IsSuccess)
throw new InvalidOperationException(string.Concat("Failed to send frames to FFmpeg. ", result.Diagnostics), inputFailure);
if (inputFailure is not (null or IOException))
ExceptionDispatchInfo.Throw(inputFailure);
return new FFmpegProcessResult(process.ExitCode, diagnostics.ToString());
return result;
}
static async Task WriteStandardInputAsync(Process process, FFmpegInputWriter writer, CancellationToken cancellationToken)
+1
ファイルの表示
@@ -10,6 +10,7 @@ public enum ProxyEncodeFailure
FFmpegFailed,
NoOutput,
SourceChanged,
GraphicsDeviceLost,
}
internal sealed class ProxyEncodeException(ProxyEncodeFailure failure, string message) : Exception(message)
+69 -45
ファイルの表示
@@ -3,6 +3,7 @@ using System.Diagnostics;
using System.Globalization;
using System.IO;
using ProxyForge.Sources;
using Vortice.DXGI;
using YukkuriMovieMaker.Commons;
using YukkuriMovieMaker.Plugin.FileSource;
@@ -35,6 +36,8 @@ internal delegate Task<IProxyEncodeSession> ProxyEncodeSessionFactory(ProxyEncod
internal sealed class ProxyEncoder(FFmpegExecutables executables, VideoSourceFactory sourceFactory)
{
const int DiagnosticExcerptLength = 200;
const int DeviceLostMaxAttempts = 3;
static readonly TimeSpan DeviceLostRetryDelay = TimeSpan.FromSeconds(1);
public async Task<IProxyEncodeSession> OpenAsync(ProxyEncodeRequest request, CancellationToken cancellationToken)
{
@@ -47,63 +50,84 @@ internal sealed class ProxyEncoder(FFmpegExecutables executables, VideoSourceFac
cancellationToken.ThrowIfCancellationRequested();
Directory.CreateDirectory(request.WorkingDirectory);
GraphicsDevices? devices = null;
IGraphicsDevicesAndContext? context = null;
IVideoFileSource? source = null;
ProxyFrameRenderer? renderer = null;
try
for (var attempt = 1; ; attempt++)
{
devices = new GraphicsDevices();
context = devices.CreateContext();
context.DeviceContext.SetDpi(ProxyFrameRenderer.ReferenceDpi, ProxyFrameRenderer.ReferenceDpi);
GraphicsDevices? devices = null;
IGraphicsDevicesAndContext? context = null;
IVideoFileSource? source = null;
ProxyFrameRenderer? renderer = null;
source = sourceFactory(context, request.SourcePath)
?? throw new ProxyEncodeException(ProxyEncodeFailure.SourceUnavailable, "No video file source plugin was able to open the input file.");
try
{
devices = new GraphicsDevices();
context = devices.CreateContext();
context.DeviceContext.SetDpi(ProxyFrameRenderer.ReferenceDpi, ProxyFrameRenderer.ReferenceDpi);
var duration = source.Duration;
if (duration <= TimeSpan.Zero)
throw new ProxyEncodeException(ProxyEncodeFailure.NoFrames, "The video source reported a zero duration.");
source = sourceFactory(context, request.SourcePath)
?? throw new ProxyEncodeException(ProxyEncodeFailure.SourceUnavailable, "No video file source plugin was able to open the input file.");
var frameCount = source.GetFrameIndex(duration);
if (frameCount <= 0)
throw new ProxyEncodeException(ProxyEncodeFailure.NoFrames, "The video source reported no frames.");
var duration = source.Duration;
if (duration <= TimeSpan.Zero)
throw new ProxyEncodeException(ProxyEncodeFailure.NoFrames, "The video source reported a zero duration.");
var frameRate = FrameRateResolver.Resolve(source.GetFrameIndex, frameCount, duration);
var frameCount = source.GetFrameIndex(duration);
if (frameCount <= 0)
throw new ProxyEncodeException(ProxyEncodeFailure.NoFrames, "The video source reported no frames.");
source.Update(frameRate.GetSampleTime(0));
var display = DisplayBounds.Measure(context.DeviceContext, source.Output);
if (!display.IsUsable)
throw new ProxyEncodeException(ProxyEncodeFailure.UnusableSize, "The video source reported an unusable image size.");
var frameRate = FrameRateResolver.Resolve(source.GetFrameIndex, frameCount, duration);
var geometry = ProxyGeometryCalculator.Calculate(display.PixelWidth, display.PixelHeight, request.Scale);
renderer = new ProxyFrameRenderer(context, source.Output, display, geometry);
source.Update(frameRate.GetSampleTime(0));
var display = DisplayBounds.Measure(context.DeviceContext, source.Output);
if (!display.IsUsable)
throw new ProxyEncodeException(ProxyEncodeFailure.UnusableSize, "The video source reported an unusable image size.");
var videoEncoder = await FFmpegEncoderSelector.ResolveAsync(
executables.FFmpegPath,
request.UsesHardwareEncoder,
geometry.Width,
geometry.Height,
request.WorkingDirectory,
cancellationToken).ConfigureAwait(false);
var geometry = ProxyGeometryCalculator.Calculate(display.PixelWidth, display.PixelHeight, request.Scale);
renderer = new ProxyFrameRenderer(context, source.Output, display, geometry);
var analysis = new ProxyAnalysis(geometry, display, frameRate, duration, frameCount);
var session = new Session(executables, request, analysis, videoEncoder, devices, context, source, renderer);
devices = null;
context = null;
source = null;
renderer = null;
return session;
}
finally
{
renderer?.Dispose();
source?.Dispose();
context?.Dispose();
devices?.Dispose();
var videoEncoder = await FFmpegEncoderSelector.ResolveAsync(
executables.FFmpegPath,
request.UsesHardwareEncoder,
geometry.Width,
geometry.Height,
request.WorkingDirectory,
cancellationToken).ConfigureAwait(false);
var analysis = new ProxyAnalysis(geometry, display, frameRate, duration, frameCount);
var session = new Session(executables, request, analysis, videoEncoder, devices, context, source, renderer);
devices = null;
context = null;
source = null;
renderer = null;
return session;
}
catch (Exception exception) when (IsDeviceLost(exception))
{
if (attempt >= DeviceLostMaxAttempts)
throw new ProxyEncodeException(ProxyEncodeFailure.GraphicsDeviceLost, "The GPU device was removed, hung, or reset.");
Log.Default.Write($"ProxyForge: GPU デバイスが失われたため再試行します。({attempt}/{DeviceLostMaxAttempts})", exception);
}
finally
{
renderer?.Dispose();
source?.Dispose();
context?.Dispose();
devices?.Dispose();
}
await Task.Delay(DeviceLostRetryDelay, cancellationToken).ConfigureAwait(false);
}
}
static bool IsDeviceLost(Exception exception)
{
if (exception is not (SharpGen.Runtime.SharpGenException or System.Runtime.InteropServices.COMException))
return false;
SharpGen.Runtime.Result result = exception.HResult;
return result == ResultCode.DeviceRemoved || result == ResultCode.DeviceHung || result == ResultCode.DeviceReset;
}
static void TryDelete(string path)
{
try
+1 -1
ファイルの表示
@@ -5,7 +5,7 @@
<UseWPF>true</UseWPF>
<ImplicitUsings>enable</ImplicitUsings>
<Nullable>enable</Nullable>
<Version>2.0.0</Version>
<Version>2.0.2</Version>
<Platforms>AnyCPU;x64;x64</Platforms>
<AllowUnsafeBlocks>True</AllowUnsafeBlocks>
</PropertyGroup>
+1
ファイルの表示
@@ -49,3 +49,4 @@ FailureTransparent,,透明を含むため対象外です,Excluded because it con
FailureFFmpegFailed,,ffmpeg が失敗しました,ffmpeg failed,ffmpeg 失败,ffmpeg 失敗,ffmpeg가 실패했습니다,ffmpeg falló,فشل ffmpeg,ffmpeg gagal
FailureNoOutput,,出力が作られませんでした,No output was produced,未生成输出,未產生輸出,출력이 만들어지지 않았습니다,No se produjo ninguna salida,لم يتم إنتاج أي مخرجات,Tidak ada keluaran yang dihasilkan
FailureSourceChanged,,元の動画が変更されました,The source video was modified,源视频已被修改,來源影片已被修改,원본 동영상이 변경되었습니다,El vídeo de origen fue modificado,تم تعديل الفيديو المصدر,Video sumber telah diubah
FailureGraphicsDeviceLost,,GPU デバイスが失われました,The GPU device was lost,GPU 设备已丢失,GPU 裝置已遺失,GPU 디바이스가 제거되었습니다,Se perdió el dispositivo de la GPU,تم فقدان جهاز الرسومات,Perangkat GPU telah hilang
1 Key Parameter ja-jp en-us zh-cn zh-tw ko-kr es-es ar-sa id-id
49 FailureFFmpegFailed ffmpeg が失敗しました ffmpeg failed ffmpeg 失败 ffmpeg 失敗 ffmpeg가 실패했습니다 ffmpeg falló فشل ffmpeg ffmpeg gagal
50 FailureNoOutput 出力が作られませんでした No output was produced 未生成输出 未產生輸出 출력이 만들어지지 않았습니다 No se produjo ninguna salida لم يتم إنتاج أي مخرجات Tidak ada keluaran yang dihasilkan
51 FailureSourceChanged 元の動画が変更されました The source video was modified 源视频已被修改 來源影片已被修改 원본 동영상이 변경되었습니다 El vídeo de origen fue modificado تم تعديل الفيديو المصدر Video sumber telah diubah
52 FailureGraphicsDeviceLost GPU デバイスが失われました The GPU device was lost GPU 设备已丢失 GPU 裝置已遺失 GPU 디바이스가 제거되었습니다 Se perdió el dispositivo de la GPU تم فقدان جهاز الرسومات Perangkat GPU telah hilang
+1
ファイルの表示
@@ -44,6 +44,7 @@ internal sealed class GenerationItemViewModel : Bindable
ProxyEncodeFailure.FFmpegFailed => Texts.FailureFFmpegFailed,
ProxyEncodeFailure.NoOutput => Texts.FailureNoOutput,
ProxyEncodeFailure.SourceChanged => Texts.FailureSourceChanged,
ProxyEncodeFailure.GraphicsDeviceLost => Texts.FailureGraphicsDeviceLost,
_ => failure.ToString(),
};
+9 -10
ファイルの表示
@@ -2,6 +2,7 @@ using System.Collections.ObjectModel;
using System.Collections.Specialized;
using System.ComponentModel;
using System.Windows;
using System.Windows.Interop;
using ProxyForge.Encoding;
using ProxyForge.ViewModels;
@@ -31,11 +32,7 @@ internal static class GenerationProgressWindowHost
Update();
}
public static void Shutdown()
{
window?.CloseForShutdown();
window = null;
}
public static void Shutdown() => window?.CloseForShutdown();
static void OnItemsChanged(object? sender, NotifyCollectionChangedEventArgs e) => Update();
@@ -56,16 +53,18 @@ internal static class GenerationProgressWindowHost
}
window ??= Create();
if (!window.IsVisible)
if (window is { IsVisible: false })
window.Show();
}
static GenerationProgressWindow Create()
static GenerationProgressWindow? Create()
{
var created = new GenerationProgressWindow(new GenerationProgressViewModel(items!, cancelAll!));
if (Application.Current?.MainWindow is { IsLoaded: true } owner)
created.Owner = owner;
if (Application.Current?.MainWindow is not { } owner || new WindowInteropHelper(owner).Handle == 0)
return null;
var created = new GenerationProgressWindow(new GenerationProgressViewModel(items!, cancelAll!)) { Owner = owner };
created.HideRequested += (_, _) => suppressed = true;
created.Closed += (_, _) => window = null;
return created;
}
}
+7 -4
ファイルの表示
@@ -11,7 +11,7 @@ YukkuriMovieMaker4(YMM4)上で動作する、編集の間だけ使う解像
動画出力のときは元の動画を読み込むため、出力した動画の画質は変わりません。
生成したファイルは YMM4 のユーザーフォルダーのキャッシュに置き、上限を超えた分は最後に使った日時が古いものから消します。
![Image](https://github.com/routersys/YMM4-ProxyForge/blob/main/docs/ProxyForge.png)
![Image](https://git.routersys.com/routersys/YMM4-ProxyForge/raw/branch/main/docs/ProxyForge.png)
---
@@ -160,17 +160,20 @@ YMM4 の設定画面の「動画読み込み」に「ProxyForge」として表
## 不具合の報告
本プラグインは、想定していない例外が起きたときに、その内容を開発者へ自動で送信します。同意は求めず、常に送信します。
本プラグインは、想定していない例外が起きたときに、その内容を開発者へ自動で送信します。同意は求めません。止める設定もありません。
送信する数には上限があります。YMM4 の 1 回の起動で送る報告は、YMM4-Telemetry で報告する別のプラグインと合わせて 20 件までです。例外の型と発生位置が同じ報告は 3 件までです。上限を超えた報告と、送信先から待つよう求められている間に起きた報告は、送信も退避もしません。
送信する情報は次のとおりです。
| 種類 | 内容 |
|---|---|
| 例外 | 型の完全名、メッセージ、スタックトレース |
| 発生位置 | モジュール名、関数名、ファイル名、行番号 |
| 発生位置 | モジュール名、関数名、ファイル名、行番号、プラグイン自身のコードかどうか |
| プラグイン | アセンブリ名、バージョン |
| 実行環境 | OS の名前とバージョン、.NET のバージョン、CPU のアーキテクチャ、論理プロセッサ数 |
| 識別子 | YMM4 の起動ごとに決まるセッション識別子、報告ごとの識別子 |
| 時刻 | 報告を作った時刻(UTC) |
メッセージとファイル名は、送信の前に置き換えを通します。置き換えるのは、Windows のユーザー名、ユーザーフォルダー、AppData のパス、マシン名、ドメイン名、メールアドレス、IPv4 アドレスです。送信元の IP アドレスは受信側へ渡す手前で取り除いています。
@@ -188,7 +191,7 @@ YMM4 の設定画面の「動画読み込み」に「ProxyForge」として表
| 更新の確認の通信の失敗 | GitHub へ接続できない |
| キャッシュの読み書きで想定している失敗 | 索引を読めない、ファイルを消せない、チャンクを開けない |
送信できなかった報告は YMM4 のユーザーフォルダーへ退避し、次回の起動時に送り直します。送信も再送も非同期に行うため、起動と生成が遅くなることはありません。
送信できなかった報告は YMM4 のユーザーフォルダーへ退避します。次に YMM4 を起動したあと、本プラグインを読み込むか、同じく YMM4-Telemetry で報告する別のプラグインが動き始めると、退避した報告を 1 回の起動で 10 件まで送り直します。送信も再送も非同期に行うため、起動と生成が遅くなることはありません。
実装は [YMM4-Telemetry](https://github.com/routersys/YMM4-Telemetry) をサブモジュールとして取り込んでいます。