roboto.experimental.video.av1#

Minimal AV1 low-overhead bitstream inspection.

AV1 has no Annex B framing: a message payload is one temporal unit — a sequence of OBUs (open bitstream units), each with a 1-2 byte header and a LEB128-coded size (AV1 Bitstream Specification section 5.2). This module walks the OBUs and parses only the fixed leading bits of the frame header needed for keyframe detection; the decoder reads everything else from the in-band sequence header.

Module Contents#

class roboto.experimental.video.av1.Obu#

One OBU split out of a low-overhead AV1 temporal unit.

payload: bytes#

The OBU’s payload bytes (header and size field excluded).

type: int#

obu_type from the OBU header.

class roboto.experimental.video.av1.ObuType#

Bases: enum.IntEnum

AV1 OBU types (AV1 Bitstream Specification section 5.3.2) relevant here.

OBU headers can carry any 4-bit type value, so Obu.type is a plain int; compare against these members for the types that matter.

FRAME = 6#
FRAME_HEADER = 3#
SEQUENCE_HEADER = 1#
TEMPORAL_DELIMITER = 2#
roboto.experimental.video.av1.find_obus(data)#

Split a low-overhead AV1 temporal unit into its OBUs.

Walking stops (returning the OBUs found so far) at the first malformed header, truncated size field, or size that overruns the payload. An OBU without a size field extends to the end of the data, as the spec allows for the last OBU of a temporal unit.

Parameters:

data (bytes) – One temporal unit’s bytes in the low-overhead bitstream format.

Returns:

The unit’s OBUs in bitstream order, payloads copied.

Return type:

list[Obu]

roboto.experimental.video.av1.is_keyframe(data)#

Whether the AV1 temporal unit contains a KEY_FRAME (clean decoder entry point).

The first frame (or frame-header) OBU’s leading bits are checked: show_existing_frame must be 0 and frame_type KEY_FRAME. When the unit’s own sequence header declares reduced_still_picture_header, the frame is a keyframe by definition (that mode only encodes intra frames).

Parameters:

data (bytes) – One temporal unit’s bytes in the low-overhead bitstream format.

Returns:

True when the unit contains a keyframe.

Return type:

bool