Expand description
Codec identities, wire framing, quantizer domains, level ladders, bitstream reads. What every encoder backend shares about a codec: its name and wire identity, the quantizer domain the session-wide quality index maps onto, the level a stream of a given geometry advertises, and the bitstream reads that label a frame on the wire.
Enums§
- Codec
- The picture codec of a capture session, and of a virtual-camera uplink.
Jpegis the striped still-image mode; the rest are video codecs, which stream as whole frames. The discriminants are the codec ids the Python API speaks (VirtualCamera.CODEC_*) and the video wire ids. - Hardware
- The hardware encoder family a session’s quantizer curve is read for
(
Codec::hardware_quantizer).
Constants§
- AV1_
NVENC_ 🔒QINDEX - Session quality index → NVENC AV1
base_q_idxbreakpoints. - AV1_
QINDEX 🔒 - Session quality index → AV1
base_q_idx(0..=255) breakpoints. - AV1_
VAAPI_ 🔒QINDEX - Session quality index → VA-API AV1
base_q_idxbreakpoints. - FRAME_
ANCHOR - A bit ORed into a delta frame’s kind: the session keeps the frame as a long-term reference and
it predicts from one every client holds (
ReferenceWindow::settle), so every client can decode it. - FRAME_
DELTA - FRAME_
INTRA - FRAME_
KEY - Frame kinds in the low nibble of the video type byte: a decode entry point, an intra-coded picture that is not one, and a predicted picture.
- H26X_
HARDWARE_ 🔒QP - Session quality index → hardware H.264 QP breakpoints, and VA-API H.265’s.
- H265_
INTEL_ 🔒QP - Session quality index → Intel VA-API H.265 QP breakpoints.
- JPEG_
HEADER_ LEN - Bytes of the JPEG stripe header and the video frame header.
- VIDEO_
HEADER_ LEN - VP8_
FINEST_ 🔒MATCHED - The finest session quality index
VP8_QINDEXmatches against x264, under which a step of the index moves VP8’s quantizer by one or none. - VP8_
LEVEL_ QINDEX - VP8 quantizer index of each libvpx VP8 quantizer level 0..=63.
- VP8_
QINDEX 🔒 - Session quality index → VP8 quantizer index (0..=127) breakpoints.
- VP8_
REFRESH_ 🔒QUANTIZER - The VP8 quantizer a capped CRF’s refresh codes a block at, at the coarsest, where the session’s
quality index is at or under
VP8_FINEST_MATCHED(Codec::refresh_index), where three index steps move VP8’s quantizer by one or two. Refreshed three steps finer, a 320x240 page of text a capped session coded bound came out 0.5 dB under the uncapped session at indices 22 to 24, and a 1280x720 page of text and UI 0.11 under at 22 and 23; at quantizer 2 they came within 0.06 dB at 22 and 23 and level or past at 24 and 25, at 4% fewer to 8% more bytes. Quantizer 3 came out under 4 (43.95 dB against 44.40 at 25), and 1 under 2 (44.68 against 44.79, at 4% more bytes); nine index steps at every index took those past 26 to quantizers 1 to 9, 4 to 17 dB past the session’s quality at up to twice the bytes. - VP9_
QINDEX 🔒 - Session quality index → VP9
base_q_idx(0..=255) breakpoints. - VP9_
VAAPI_ 🔒QINDEX - Session quality index → VA-API VP9
base_q_idxbreakpoints. - VPX_
QINDEX base_q_idxof each libvpx / libaom quantizer level 0..=63, as those libraries map their--min-q/--max-q/--cq-levelarguments.- WIRE_
JPEG - Wire tag of a JPEG stripe:
u8 reserved,u16 frame id,u16 stripe Y, JPEG data. - WIRE_
VIDEO - Wire tag of an encoded video frame: a type byte whose low nibble is the frame kind and
whose high nibble is the codec’s
Codec::wire_id, thenu16 frame id,u16 y(the frame’s top row, 0),u16 width,u16 height,u16 reference(the frame it predicts from, its own id where it names none), and the codec’s own bitstream.
Functions§
- av1_
is_ key - Whether an AV1 temporal unit opens with a key frame: the first frame header or frame
OBU’s
frame_type, read past any temporal delimiter and sequence header. A show existing frame, or a unit without a frame, is a delta. - av1_
level - Lowest AV1 level whose Annex A limits admit a
widthxheightstream atfpscarrying up tobitrate_bps(0 where no rate is declared), as seq_level_idx (8 = 4.0, 13 = 5.1, 19 = 6.3). - frame_
type_ from_ key - The frame kind of a key/delta answer an encoder reports without a bitstream parse.
- h264_
dpb_ frames - The decoded picture buffer, in frames, an H.264 stream at
levelmay declare for awidthxheightpicture: the level’s MaxDpbMbs over the picture’s macroblocks, at mostREFERENCE_FRAMES. - h264_
frame_ type - Wire frame kind of one encoded H.264 access unit, read from the bitstream itself: IDR = key, intra-only non-IDR = intra, predicted = delta. The video header labels real decode entry points, so the NAL and slice types the encoder actually produced decide, never what was requested of it. An access unit whose slices cannot be parsed is labeled delta: a false delta costs one skipped entry point, a false key breaks the decoder.
- h264_
level - Lowest H.264 level whose Annex-A Table A-1 limits admit a
widthxheightstream atfpscarrying up tobitrate_bps(0 where no rate is declared), as level_idc (41 = 4.1, 52 = 5.2, 62 = 6.2). - h264_
reference_ level - The level an x264 session declares so its decoded picture buffer holds
REFERENCE_FRAMES: the lowest fromlevelup to 5.2 whose buffer admits them atwidthxheight, else 5.2, orlevelitself above 5.2. - h264_
slice_ 🔒is_ intra - Whether a non-IDR H.264 slice header opens an I/SI slice. Reads
first_mb_in_sliceandslice_type(both ue(v)) from the start of the slice RBSP, undoing emulation prevention bytes;Nonewhen the header is truncated or malformed. - h265_
dpb_ frames - The reference frames an H.265 stream at
levelmay hold for awidthxheightpicture: the decoded picture buffer A.4.2 sizes (six pictures at the level’s full MaxLumaPs, more for a smaller picture) less the picture being decoded, at mostREFERENCE_FRAMES. - h265_
frame_ type - Wire frame kind of one encoded H.265 access unit: an IRAP picture (BLA, IDR, or CRA, which every backend here emits as an IDR with its parameter sets) is a key, anything else a delta.
- h265_
level - Lowest H.265 level whose Annex-A Tables A.8 and A.9 limits admit a
widthxheightstream atfpscarrying up tobitrate_bps(0 where no rate is declared) at the High tier or the Main one, as general_level_idc (123 = 4.1, 156 = 5.2, 186 = 6.2). - h265_
tier - The tier an H.265 session declares at
level(general_level_idc): High (1) from level 4.0 up, where Annex A defines one and every decoder of those levels takes it, so a CBR target above the level’s Main-tier MaxBR is not refused by an encoder that validates the two together; Main (0) below, where no High tier exists. - interpolate 🔒
- Piecewise-linear lookup of
xin ascending(x, y)breakpoints, clamped at both ends. - nearest_
index 🔒 - The quality index in
0..=51whose quantizer is nearestq, the lowest on a tie. - parse_
video_ type - The codec and frame kind a video type byte carries.
- push_
jpeg_ header - Append the header of one JPEG stripe.
- push_
video_ header - Append the header of one encoded video frame: the tag, the codec and frame kind, then the frame id, its top row, its width and height, and the id of the frame it predicts from, all big-endian u16. A frame that predicts from none, or whose encoder does not say, names itself there.
- vp8_
is_ key - Whether a VP8 frame is a key frame: the frame tag’s lowest bit is clear.
- vp9_
base_ q_ idx - The
base_q_idxof a VP9 frame, read from its uncompressed header past the color configuration, the frame size, the references, and the loop filter; None for a shown existing frame or a header cut short. - vp9_
is_ key - Whether a VP9 frame is a key frame, read from its uncompressed header: not a shown existing
frame, and
frame_typeKEY_FRAME. Profile 3 carries one reserved bit ahead of those two. - vpx_
level - The libvpx / SVT-AV1 quantizer level (0..=63) closest to a quantizer index of
codec’s domain: the software encoders take the level, the hardware ones the index.