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

roboto.experimental.video.codec

Codec seam for the GOP-aware stream decoder.

Isolates the per-codec bitstream knowledge (keyframe detection) and the PyAV decoder name behind one small value type, so decoder.decode_stream() stays codec-agnostic: it depends on a VideoCodec, never on a specific codec’s bitstream format. H.264, H.265, VP9, and AV1 are registered; a new codec adds a VideoCodec here plus one _REGISTRY entry, with no change to the decoder.

Module Contents

AV1

roboto.experimental.video.codec.AV1#View Source

H264

roboto.experimental.video.codec.H264#View Source

H265

roboto.experimental.video.codec.H265#View Source

VP9

roboto.experimental.video.codec.VP9#View Source

VideoCodec

class roboto.experimental.video.codec.VideoCodec#View Source

The per-codec hooks the generic stream decoder depends on.

A codec is data plus one function: the PyAV decoder name and a predicate that recognizes an independently decodable keyframe from an encoded frame’s bytes. Everything else about decoding (GOP skipping, log-time remapping, error recovery) is codec-agnostic and lives in the decoder.

Attributes

VideoCodec.decoder_thread_count

decoder_thread_count int | None = None #

Fixed thread_count for the decoder context, or None for FFmpeg’s default.

VideoCodec.formats

formats frozenset[str] #

Per-message format tokens that resolve to this codec (compared lowercase).

VideoCodec.is_keyframe

is_keyframe collections.abc.Callable[[bytes], bool] #

Whether an encoded frame is an independently decodable keyframe (clean entry point).

VideoCodec.name

name str #

Canonical codec name (matches the per-message format field, lowercase).

VideoCodec.pyav_codec_name

pyav_codec_name str #

Decoder name passed to PyAV’s CodecContext.create.

resolve_codec()

roboto.experimental.video.codec.resolve_codec(format)#View Source

Return the codec registered for a per-message format token.

Parameters

format str

The per-message format field of a compressed-video message (e.g. "h264"); matched case-insensitively.

Returns

VideoCodec | None

The matching VideoCodec, or None when no registered codec claims the token (the stream carries a codec with no decode path).

supported_formats()

roboto.experimental.video.codec.supported_formats()#View Source

The per-message format tokens that have a decode path, lowercase.

Return type

frozenset[str]

Was this page helpful?