Repository navigation
perf(media-local): reuse video frames that meet normalization requirements - #389
Merged
Merged
Conversation
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.
Normalize can reuse opaque H.264/yuv420p frames in Baseline, Main or High profiles up to level 4.1 after verifying their exact presentation timestamps, durations, frame count, dimensions, square pixels, progressive scan and rotation. Matching single-video-stream MP4 inputs retain their original Blob. Matching files with additional streams are copied into a silent MP4 and inspected before use. Inputs that require conversion or cannot be verified use the existing encoder path.
The normalized frame domain and audio-alignment behavior stay consistent. Reused video preserves source pixels and avoids another lossy encode; its bitrate and keyframe spacing follow the source.
Validation:
Type check and the existing Node 24 suite passed: 1,123 tests passed, 24 skipped. The media-local suite passed all 33 tests.
Real-media comparisons covered 30 fps and 30000/1001 fps video, audio-first stream selection, variable frame timing, rotation, non-square pixels and yuv444p conversion. Frame timing, frame counts and output dimensions matched the previous implementation; selected audio PCM matched. Reused/copied video decoded identically to its source, and conversion cases decoded identically to the previous output.
All seven normalized results completed through the existing MP4 mux implementation and full-file decoding.
Local HypiHub packaged the changed media-local implementation and completed browser HTML checks for its three existing Candidate-backed repository projects. A compatible 720×1280 real clip used stream copying, retained sampled source pixels, and completed a 120-frame, 4-second browser H.264/AAC export with full-file decoding.
No version bump or npm release is included.