Skip to content
Roboto
Esc
↑↓navigate↵open⌘Jpreview
On this page

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

Obu

class roboto.experimental.video.av1.Obu#View Source

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

Attributes

Obu.payload

payload bytes #

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

Obu.type

type int #

obu_type from the OBU header.

ObuType

class roboto.experimental.video.av1.ObuType#View Source

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.

Attributes

ObuType.FRAME

FRAME = 6 #

ObuType.FRAME_HEADER

FRAME_HEADER = 3 #

ObuType.SEQUENCE_HEADER

SEQUENCE_HEADER = 1 #

ObuType.TEMPORAL_DELIMITER

TEMPORAL_DELIMITER = 2 #

find_obus()

roboto.experimental.video.av1.find_obus(data)#View Source

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

list[Obu]

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

is_keyframe()

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

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

bool

True when the unit contains a keyframe.

Was this page helpful?