feat(review): High quality playback switch and per-version ProRes download
Deploy / deploy (push) Successful in 3m23s

Worker 1.7.0 (preview.highQuality, default on) now, after the AE render:
- encodes a High quality MP4 from the delivery MOV (full-res H.264 High,
  CRF 14 capped at 100 Mbps) -> Version.hqFileUrl
- uploads the MOV itself -> Version.highResKey/Filename/Size
Both best-effort (the preview never fails over them), with a lease
keep-alive during the long encode/uploads; the export timeline records
what was attached.

Player: HQ switch when a High quality source exists; keeps frame, play
state, speed and zoom, remembered per browser, falls back to Standard if
the file won't load. ProRes itself stays download-only (browser support).

Downloads: the client portal's High Res button serves the version's
ProRes (client-code filename), falling back to the shot's manual file;
staff get a ProRes button on the review page.

Housekeeping (lib/render-pipeline/high-res.ts): HQ MP4 + ProRes are kept
while a version is latest, client-shared, approved or younger than
preview.highResRetentionDays (14); otherwise deleted from storage. Runs
per task after finalize and hourly from the reaper; deleting a version or
a reslate removes its files. The Standard MP4 is never touched.

Also: ProRes/Handles top-bar buttons go icon-only below lg so they don't
overlap the version selector.

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
This commit is contained in:
twotalesanimation
2026-09-22 16:32:18 +02:00
parent bae46c2968
commit 9660cdc21c
27 changed files with 793 additions and 18 deletions
@@ -441,6 +441,32 @@ public sealed class JobExecutor
job.Id, machineId, "thumbnail", result.ThumbnailPath, "image/jpeg", shutdown);
}
// High quality MP4 + the MOV as the version's High Res download
// (§9.6). Both optional: a failure here costs the extras, never the
// preview, which is already safely uploaded.
string? hqKey = null;
string? highResKey = null;
long? highResSize = null;
if (manifest.HighQuality)
{
await using var keepAlive = new LeaseKeepAlive(_api, job.Id, machineId, TimeSpan.FromSeconds(60), shutdown);
var hqPath = await _preview.TryMakeHighQualityAsync(job.Id, result.MovPath!, result.Mp4Path!, shutdown);
if (hqPath is not null)
{
hqKey = await _api.UploadArtifactAsync(job.Id, machineId, "preview", hqPath, "video/mp4", shutdown);
if (hqKey is null) _log.LogWarning("High quality MP4 upload failed for job {JobId}", job.Id);
}
if (result.MovPath is not null && File.Exists(result.MovPath))
{
highResSize = new FileInfo(result.MovPath).Length;
highResKey = await _api.UploadArtifactAsync(
job.Id, machineId, "highres", result.MovPath, "video/quicktime", shutdown);
if (highResKey is null) _log.LogWarning("ProRes upload failed for job {JobId}", job.Id);
}
}
_spooler.Enqueue("finalize", job.Id, new Dictionary<string, object?>
{
["machineId"] = machineId,
@@ -449,6 +475,10 @@ public sealed class JobExecutor
["deliveryMovPath"] = manifest.MovOutput,
["previewMovKey"] = previewKey,
["thumbnailKey"] = thumbKey,
["hqPreviewKey"] = hqKey,
["highResKey"] = highResKey,
["highResFileName"] = highResKey is null ? null : Path.GetFileName(result.MovPath),
["highResSize"] = highResKey is null ? null : highResSize,
},
["renderStats"] = new Dictionary<string, object?>
{
@@ -494,6 +524,12 @@ public sealed class JobExecutor
PreviewStage.TryDelete(Path.Combine(WorkerOptions.ScratchDir, $"job_{jobId}_run.jsx"));
PreviewStage.TryDelete(Path.Combine(WorkerOptions.ScratchDir, $"job_{jobId}_thumb.jpg"));
if (tempAep is not null) PreviewStage.TryDelete(tempAep);
try
{
var hqDir = PreviewStage.HighQualityDir(jobId);
if (Directory.Exists(hqDir)) Directory.Delete(hqDir, recursive: true);
}
catch { /* scratch only */ }
}
/// <summary>