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.PPCCLLhex from SPS) - HEVC: ISO/IEC 14496-15 §A.5
Emits AV1, H.264 (avc1/avc3), H.265 (hvc1/hev1), and AAC strings.
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. - avc_
codec_ string - H.264 codec string
<fourcc>.PPCCLLper RFC 6381 §3.3 — hex bytes from the SPS:PP=profile_idc,CC= the packedconstraint_setflags byte,LL=level_idc.fourccis the sample-entry type:avc1(parameter sets out-of-band inavcC) oravc3(in-band). Example: High@L4.0 →avc1.640028. - hevc_
codec_ string - H.265 codec string
<fourcc>.{space}{profile}.{compat}.{tier}{level}{.cons}*per ISO/IEC 14496-15 §E.3, parsed from the SPS profile_tier_level: - 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.