Skip to main content

Module codec_strings

Module codec_strings 

Source
Expand description

HLS / DASH CODECS attribute string generation.

Generates the precise codec-string bytes that go into the #EXT-X-STREAM-INF:CODECS="..." line of a HLS master playlist. These strings are what hls.js (and Safari’s native HLS, and DASH players) use to decide whether the browser can play a given variant BEFORE downloading any media bytes. A wrong string causes the variant to be silently skipped, so they have to be parsed from the actual bitstream — never composed from a config file.

Sources of truth:

  • AV1: AV1 Codec ISO Media File Format Binding v1.2.0 §A.3, “Codecs Parameter String”
  • AAC-LC in MP4: ISO/IEC 14496-3 + RFC 6381 §3.3
  • AVC: RFC 6381 §3.3 (avc1.PPCCLL hex from SPS)
  • HEVC: ISO/IEC 14496-15 §A.5

We currently emit AV1 and AAC strings. AVC / HEVC formatters are sketched as future work for when those codecs ride through the pipeline as outputs.

Constants§

AAC_LC_CODEC_STRING
AAC-LC in MP4 codec string. Always mp4a.40.2:

Functions§

av1_codec_string
AV1 codec string — av01.P.LLT.DD.M.CCC.TTT.MMM.F.
hls_codecs_attribute
Convenience: pack an HLS CODECS= attribute value for a variant that carries one video and one audio track. Order is <video>,<audio> per RFC 8216 §4.3.4.2 and HLS-Authoring spec.