feat: AV1 OBU parsing, sequence header, and codecs parameter string#522
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.
Summary
Extends the basic AV1 support (previously just the opaque
av1Cbox) with the elementary-stream understanding needed for AV1 streaming in HLS/DASH/CMAF/MoQ manifests. This lays the foundation (codec string + OBU/sequence-header parsing); DRM protect-ranges and key-frame detection are natural follow-ups that build on the OBU layer added here.What's included
OBU layer (
av1/obu.go) — the AV1 analog of NALU handling:OBUTypewith all defined types,ParseOBUHeader(incl. the extension header),ReadLEB128, andSplitOBUsto split an av1CconfigOBUsfield, a coded sample, or a temporal unit into OBUs. AV1 carries no emulation-prevention bytes, so parsing reads the raw bytes directly.Sequence header + codec string (
av1/seqhdr.go,av1/mime.go):ParseSequenceHeader/SequenceHeader— a faithful walk ofsequence_header_obu()(spec §5.5), including the offset-critical operating-points loop and fullcolor_config(), exposing profile/level/tier,Width()/Height(), bit depth, and color configuration.CodecConfRec.SequenceHeader()— parse the sequence header carried in an av1C record.CodecConfRec.CodecString(mandatoryav01.P.LLT.DD) andSequenceHeader.CodecString(full form with the color suffix, collapsing to the short form only when all six color fields are at their defaults).Integration:
av1CboxInfo()now prints the codecs parameter, coded resolution, and color configuration.mp4ff-pslisterparses the av1C record ofav01tracks in mp4 files and prints the sequence header + codecs parameter.Testing
MP4FF_AV1_TESTVECTORS_DIR): every temporal unit splits with full byte consumption, and every parsed resolution matches the IVF display header — including the SVC files (multiple operating points, extension flags) and dynamic-resolution streams.FuzzSplitOBUs/FuzzParseSequenceHeader(no panics over millions of executions).mp4ff-pslisteragainst a small realav01init segment.go test ./...,go vet, andgolangci-lintall clean.🤖 Generated with Claude Code