Cap video input resolution to pipeline's pixel budget#482
Merged
Conversation
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]>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
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)customVideoResolutionis 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 buildpasses with no type errors🤖 Generated with Claude Code