Expand description
Turning pictures into packets: H.264 through the operating system, AV1
through the bundled rav1e.
The mirror of crate::decode — one trait, several backends, and a runtime
choice that says plainly why it chose nothing when it does.
§Two formats, two rules
| Encoding | Backend | Why this one |
|---|---|---|
| H.264 — the default | VideoToolbox (macOS, iOS), Media Foundation (Windows), MediaCodec (Android) | Universal hardware decode, everywhere a file goes. Patent-pooled, so only ever the OS’s encoder — never x264, never openh264 |
| AV1 | rav1e, bundled | Royalty-free and pure Rust, so it ships inside every transcode build. Written only when asked for: vtome cannot yet play it back on most machines |
§What the files look like
Every H.264 file vtome writes meets the universal baseline in
planning/TODO.md §15, because what a file declares decides whether a
hardware decoder takes it: High profile at Level 4.1 (8,192 macroblocks
a frame and 245,760 a second — 1080p30 or 720p60 — so a bigger or faster
picture is scaled down to fit, see fit_level), 8-bit 4:2:0, no
B-frames, a keyframe every two seconds exactly so every GOP is closed, and
CABAC. AV1 follows the same shape where it applies: 8-bit 4:2:0, no frame
reordering, a keyframe every two seconds.
Structs§
- Encoder
Config - How to encode.
Enums§
Constants§
Traits§
- Encoder
- Something that turns frames into packets.
Functions§
- backends_
for - Which backends could encode this, here, in this build, under
hardware. - default_
encoding - What
importwrites when not told: H.264, always — the format every hardware decoder plays (§15).Nonewhere the OS offers no H.264 encoder vtome may use; AV1 is then written only when asked for, since vtome cannot yet play AV1 back on most machines (§2). - fit_
level - The size a picture of
width×heightatframe_rateis encoded at, underlevel: unchanged if it fits, otherwise the largest even size of the same shape that does. - is_
available - Whether
openwould find an encoder forencodingunderhardware, without opening one. - open
- An encoder for this configuration.