Repository navigation
fix(engine): a video on a non-square pixel grid renders at its display shape - #6772
Merged
Merged
Conversation
Contributor
There was a problem hiding this comment.
Verdict: REQUEST CHANGES · 1 blocker · 0 important · 1 nit
A rotated phone clip with a non-square sample aspect ratio still comes out the wrong shape (inline). The fix is one line.
Scope
Read the ffprobe.ts and videoFrameExtractor.ts changes. This filter chain is the only frame-extraction -vf site in the engine. Confirmed the red-first claim: with the extractor hunk reverted, the named test fails with '64,64' vs '32,64'. CI was still running when this was posted.
Contributor
Edit accuracy: accurate 271 (base branch 271), smooth 129 of thoseThe gate passes. Quarantined, measured but not gated (0) |
github-merge-queue
Bot
removed this pull request from the merge queue due to failed status checks
Oct 30, 2026
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.
What
A video stored on a non-square pixel grid (for example a phone HEVC clip stored 2160x2160 with sample aspect ratio 9:16) now renders at the shape it displays, so
object-fit: containletterboxes it as a 9:16 picture instead of a full square.Why
The probe never read
sample_aspect_ratioand the frame extraction never applied it. FFmpeg writes the frames on the stored grid, so a 2160x2160 clip with SAR 9:16 came out as 2160x2160 pixels and filled a square composition, while Chrome plays the same file as 9:16. Extraction now scales by the sample aspect ratio and sets it to square (scale=trunc(iw*sar/2)*2:ih,setsar=1using the filter's ownsar, which stays correct after ffmpeg's autorotate), after the frame-rate sampling so only kept frames are scaled. Streams with square pixels, "0:1" or "N/A" are untouched.Testing
fails without the fix:
a clip stored on a non-square pixel grid extracts frames at the shape Chrome displays, not the stored gridgivesexpected '64,64' to be '32,64'with the extractor change reverted.A second test,
keeps the display shape of a rotated clip, whose autorotate swaps the pixel aspect, fails (expected '32,64' to be '128,64') when the stored-grid ratio is used. With the fixvideoFrameExtractor.test.tsandffprobe.test.tspass 342 of 342, three runs in a row;tsc --noEmitinpackages/engineclean.What I measured
object-fit: containcomposition renders non-black across all 1080 columns in bothrenderandsnapshot(expected about 607).What I did NOT execute