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#
- roboto.experimental.video.codec.AV1#
- roboto.experimental.video.codec.H264#
- roboto.experimental.video.codec.H265#
- roboto.experimental.video.codec.VP9#
- class roboto.experimental.video.codec.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.
- decoder_thread_count: int | None = None#
Fixed
thread_countfor the decoder context, orNonefor FFmpeg’s default.
- formats: frozenset[str]#
Per-message
formattokens that resolve to this codec (compared lowercase).
- is_keyframe: collections.abc.Callable[[bytes], bool]#
Whether an encoded frame is an independently decodable keyframe (clean entry point).
- name: str#
Canonical codec name (matches the per-message
formatfield, lowercase).
- pyav_codec_name: str#
Decoder name passed to PyAV’s
CodecContext.create.
- roboto.experimental.video.codec.resolve_codec(format)#
Return the codec registered for a per-message
formattoken.- Parameters:
format (str) – The per-message
formatfield of a compressed-video message (e.g."h264"); matched case-insensitively.- Returns:
The matching
VideoCodec, orNonewhen no registered codec claims the token (the stream carries a codec with no decode path).- Return type:
VideoCodec | None
- roboto.experimental.video.codec.supported_formats()#
The per-message
formattokens that have a decode path, lowercase.- Return type:
frozenset[str]