Skip to content

Record hybrid HD frame extraction benchmarks and latency results - #254

Draft
devhims wants to merge 1 commit into
mainfrom
chore/hybrid-frame-benchmark
Draft

devhims wants to merge 1 commit into
mainfrom
chore/hybrid-frame-benchmark

Conversation

@devhims

@devhims devhims commented Nov 6, 2026

Copy link
Copy Markdown
Owner

Problem / Motivation

HD frame extraction can fail when YouTube rejects Worker-generated playback tokens. We needed to test whether a container-generated session could support Worker HD fetching and Cloudflare Media decoding, and measure the cost of first requests and subsequent seeks.

What changed

Adds an isolated, authenticated benchmark for two videos, with a 90-second session cache tied to the dedicated proxy route. Records stage timings, verifies 1920×1080 JPEGs, and preserves sanitized results, including failures. The streaming dependency is pinned separately from production.

%%{init: {"themeVariables": {"sequenceNumberColor": "#ffffff", "signalColor": "#4b5563", "actorBkg": "#f3f4f6", "actorTextColor": "#111827"}}}%%
sequenceDiagram
    autonumber
    participant W as Benchmark Worker
    participant C as Session container
    participant Y as YouTube via proxy
    participant M as Cloudflare Media
    W->>C: Create session on first request
    C-->>W: Attested playback session
    W->>Y: Fetch HD using new or cached session
    W->>M: Decode short video clips
    M-->>W: 1080p frames
Loading

The container creates sessions; the Worker fetches media and passes clips to Media.

Tests

  • Type checking, JavaScript syntax checks, Worker bundling, and credential/scope checks pass.
  • The shifted-timeline B-frame fixture preserves the exact decoded frame digest.
  • Recorded hosted tests passed all 12 matched requests after services were ready. First requests took 13.0–17.5 seconds; cached seeks took 2.1–5.85 seconds, with one 16.15-second outlier.
  • Seven of 20 total extraction attempts failed during startup or rollout.

Deployment notes

Experimental benchmark only. Production is unchanged; temporary resources and secrets were removed. Rerunning requires the retained container base image. The final startup-wait correction passed local validation but has not been validated on Cloudflare. Full evidence and limitations are in platform/benchmarks/frame-playback/hybrid/README.md.

@vercel

vercel Bot commented Nov 6, 2026 •

Copy link
Copy Markdown

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Actions Updated
video2ctx-web Ready Ready Preview Nov 6, 2026 7:42am UTC

devhims commented Nov 6, 2026

Copy link
Copy Markdown
Owner Author

Reviewed head 94c6885add5e96079b60c932bd5a99f0f0e1eb88.

Verdict: changes needed.

  • P2: Session cancellation does not reach the Python subprocess. session-server.mjs:76–91 starts Python with a fresh 40-second timeout but does not pass the existing abort signal. In a local isolated harness, shortening that signal to 10 ms and completing the subprocess at 30 ms produced a successful session response after the signal had aborted. Slow provider startup followed by Python can therefore continue holding the singleton busy after the intended cancellation, potentially disrupting a following benchmark request. Please propagate cancellation to the subprocess and verify cleanup on timeout and abandoned requests. This is a reproduced local lifecycle issue; I did not reproduce a hosted failure.

Verification: narrow benchmark typecheck and both JavaScript syntax checks passed. Auth, URL restrictions and sanitized saved results passed independent mocked checks. A shifted-timeline B-frame fixture decoded to the same frame MD5 before and after remuxing. The recorded 20 attempts reconcile to 13 successes and seven failures. Seven of eight required Verify jobs passed; Auth E2E remains in progress.

Limits: the retained base image contains helper implementations absent from this PR, so their network behavior and error sanitization could not be independently inspected. The final startup correction has not been tested on Cloudflare.

This branch was successfully deployed

1 active deployment
Preview — 94c6885a Deployed Nov 6, 2026 by vercel[bot]
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant