Skip to content

perf(media-local): reuse video frames that meet normalization requirements - #389

Merged
rponeawa merged 2 commits into
mainfrom
codex/normalize-media-reuse
Oct 14, 2026
Merged

rponeawa merged 2 commits into
mainfrom
codex/normalize-media-reuse

Conversation

@rponeawa

@rponeawa rponeawa commented Oct 14, 2026 •

Copy link
Copy Markdown
Member

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.

@rponeawa
rponeawa merged commit dc2b7a8 into main Oct 14, 2026
9 checks passed
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