Skip to content

Cap video input resolution to pipeline's pixel budget#482

Merged
yondonfu merged 1 commit intomainfrom
cap-video-input-resolution
Feb 18, 2026
Merged

Cap video input resolution to pipeline's pixel budget#482
yondonfu merged 1 commit intomainfrom
cap-video-input-resolution

Conversation

@yondonfu
Copy link
Copy Markdown
Contributor

@yondonfu yondonfu commented Feb 18, 2026

Summary

  • Adds fitResolutionToPixelBudget() utility that scales a source resolution down to fit within a max pixel count while preserving aspect ratio (dimensions rounded to the pipeline's required scale factor)
  • Applies pixel budget capping at all 5 places where video input resolution flows into pipeline settings: NDI source probing, webcam/uploaded video detection, mode switches, pipeline changes, and post-download initialization
  • Raw customVideoResolution is preserved in state so it can be re-capped correctly when the user switches pipelines (different pipelines have different pixel budgets)

Example: NDI 1280×720 + LongLive text mode (default 576×320 = 184K pixels) → scaled to 576×320 (same 16:9 aspect ratio, fits pixel budget)

Test plan

  • npm run build passes with no type errors
  • Connect an NDI source at 1280×720, select it in UI → resolution in settings shows ~576×320 for LongLive text mode (not 1280×720)
  • Upload a 1920×1080 video → resolution is capped to pipeline's pixel budget
  • Switch pipelines while in video mode → resolution re-caps to the new pipeline's budget
  • Switch from text to video mode with a previously uploaded video → resolution is capped

🤖 Generated with Claude Code

When a video input (NDI source, webcam, or uploaded video) has a
resolution larger than the pipeline can handle in real-time, scale it
down to fit within the pipeline's default pixel budget while preserving
the source's aspect ratio. This prevents OOMs, black screens, and slow
output when connecting high-resolution sources to diffusion pipelines.

Co-Authored-By: Claude Opus 4.6 <[email protected]>
Signed-off-by: Yondon Fu <[email protected]>
@yondonfu yondonfu merged commit 589be62 into main Feb 18, 2026
6 checks passed
@yondonfu yondonfu deleted the cap-video-input-resolution branch February 18, 2026 01:13
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