Skip to main content

Module h264

Module h264 

Source
Available on crate features codec-h264 and codec only.
Expand description

H.264 (AVC) bitstream helpers: NAL iteration, Annex-B ↔ AVCC conversion, and SPS resolution extraction.

Structs§

H264
CodecParser implementation for H.264 / AVC.
SpsInfo
Decoded video dimensions and profile from a sequence parameter set.

Constants§

NAL_IDR
NAL unit type for a coded slice of an IDR picture (keyframe).
NAL_PPS
NAL unit type for a picture parameter set.
NAL_SPS
NAL unit type for a sequence parameter set.

Functions§

annexb_to_avcc
Convert an Annex-B bytestream to AVCC (length-prefixed) with a 4-byte length.
avcc_to_annexb
Convert an AVCC (length-prefixed) bytestream to Annex-B (00 00 00 01).
hls_codec_string
The HLS CODECS attribute for H.264, e.g. "avc1.4d401f" (profile/level encoded as avc1.PPCCLL). The middle byte is the constraint-set flags (0).
iter_nals_annexb
Iterate the NAL units of an Annex-B (00 00 01 / 00 00 00 01) bytestream, yielding each NAL payload without its start code.
parse_sps
Parse a sequence parameter set NAL (including its 1-byte NAL header) and extract the coded resolution. Returns None on a malformed SPS or one using a scaling matrix (unsupported here).