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
H264
H265
VP9
VideoCodec
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
Fixed thread_count for the decoder context, or None for FFmpeg’s default.
VideoCodec.formats
Per-message format tokens that resolve to this codec (compared lowercase).
VideoCodec.is_keyframe
Whether an encoded frame is an independently decodable keyframe (clean entry point).
resolve_codec()
Return the codec registered for a per-message format token.
Parameters
format strThe per-message format field of a compressed-video message (e.g. "h264"); matched case-insensitively.
Returns
The matching VideoCodec, or None when no registered codec claims the token (the stream carries a codec with no decode path).
supported_formats()
The per-message format tokens that have a decode path, lowercase.
Return type