Repository navigation
Save's MP4 writer: hls.js's own code where it was unchanged, a fingerprint test for the rest - #631
Merged
Merged
Conversation
…t is checked against it MP4Generator.mjs started as a copy of hls.js's mp4-generator and became FastStream's writer of a whole MP4 file. Of its functions, 15 were still hls.js 1.7.4's, unchanged. - The video sample entries (avc1, hvc1) are hls.js's own now: hls2mp4 writes them with hls.js's MP4 (one more name in the patch's export line) and hands them over as the track's codecBuffer, as a DASH track's already was. The fragment boxes (moof, traf, trun, mfhd, mvex, trex, mdat), used only by the tests' fMP4 helper, come from hls.js too. MP4Generator: 966 -> 696 lines. Not imported there: a DASH save would load hls.js. - tests/unit/mp4WriterUpstream.test.mjs fingerprints (comments and whitespace left out) each hls.js function FastStream keeps its own version of, and normalizePts: an hls.js update that changes one fails in its own pull request, saying what to compare. It also checks the export and that no DASH save module imports hls.js. Saved files are byte for byte the same: every box the writer returned across the 49 save tests (H.264, HEVC, AAC, MP3, AC-3, fMP4) hashed before and after, 1,745 identical. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
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.
Follow-up to the dependency audit: the one piece of other projects' code that no update workflow watched was the save's MP4 writer. MP4Generator.mjs started as a copy of hls.js's
mp4-generator. This PR puts it on the normal hls.js update path instead of a separate watcher.What changes
Compared function by function with hls.js 1.7.4, 15 of its functions were still hls.js's code, unchanged.
avc1,hvc1) come from hls.js's ownMP4, exported through one more name in the hls.js patch's single export line. hls2mp4 writes them and hands them over as the track'scodecBuffer, the pass-through a DASH track already uses.moof,traf,trun,mfhd,mvex,trex,mdat) were used only by the tests' fMP4 helper; it now uses hls.js's.tkhd, the audio entries andnormalizePts, with comments and whitespace ignored. An hls.js update that changes one fails in that update's own PR (twice red →hold+ a "Migration" issue), and the message says what to compare.MP4.Why not take over all 15 unchanged functions: hls.js's functions call each other as
MP4.x. Itsminformoovwould write its own empty sample table and fragment header into a plain MP4 file.Proof that nothing changes
stsd. All 178 boxes now written by hls.js are there again unchanged.🤖 Generated with Claude Code