Skip to content

feat: AV1 OBU parsing, sequence header, and codecs parameter string#522

Merged
tobbee merged 8 commits into
masterfrom
av1-update
Jul 7, 2026
Merged

feat: AV1 OBU parsing, sequence header, and codecs parameter string#522
tobbee merged 8 commits into
masterfrom
av1-update

Conversation

@tobbee

@tobbee tobbee commented Jul 7, 2026

Copy link
Copy Markdown
Collaborator

Summary

Extends the basic AV1 support (previously just the opaque av1C box) 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:

  • OBUType with all defined types, ParseOBUHeader (incl. the extension header), ReadLEB128, and SplitOBUs to split an av1C configOBUs field, 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 of sequence_header_obu() (spec §5.5), including the offset-critical operating-points loop and full color_config(), exposing profile/level/tier, Width()/Height(), bit depth, and color configuration.
  • CodecConfRec.SequenceHeader() — parse the sequence header carried in an av1C record.
  • RFC 6381 codecs parameter per the AV1-ISOBMFF binding: CodecConfRec.CodecString (mandatory av01.P.LLT.DD) and SequenceHeader.CodecString (full form with the color suffix, collapsing to the short form only when all six color fields are at their defaults).

Integration:

  • av1C box Info() now prints the codecs parameter, coded resolution, and color configuration.
  • mp4ff-pslister parses the av1C record of av01 tracks in mp4 files and prints the sequence header + codecs parameter.

Testing

  • Unit tests for OBU header/LEB128/splitting, sequence-header parsing, and codec-string formatting (tier, 10/12-bit, monochrome, 4:4:4, default collapse).
  • Validated against all 11 AOM fate-suite AV1 vectors (opt-in via 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.
  • Fuzz targets FuzzSplitOBUs / FuzzParseSequenceHeader (no panics over millions of executions).
  • New golden tests in mp4ff-pslister against a small real av01 init segment.

go test ./..., go vet, and golangci-lint all clean.

🤖 Generated with Claude Code

@tobbee tobbee merged commit b9ea58d into master Jul 7, 2026
9 checks passed
@tobbee tobbee deleted the av1-update branch July 7, 2026 12:42
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