Expand description
The compression engine contract and shared types.
Key architectural decision: core is designed around the Engine
interface even while there is exactly one engine (media/ffmpeg). This lets us
plug in images/PDF/office later without rewriting the skeleton.
Principle: Engine::plan is a pure, testable function (bitrate math);
side effects are isolated in Engine::run.
Modules§
- media
- Media engine v0.1: video + audio via ffmpeg (external process).
- plan
- The pure half of the media engine: planning an encode (video bitrate under
a size target, quality mode, resolution / fps caps, the audio decision,
output container, metadata tags) and the small calculations the run loop
uses (the size-target ceiling, overshoot corrections). No ffmpeg — this is
what builds without the
ffmpegfeature (e.g. for iOS).
Structs§
- Audio
Spec - Audio encoding parameters (absent means drop the track).
- Capture
Meta - Capture metadata read from the source’s container tags. iPhone videos keep
these as
com.apple.quicktime.*keys; others use plainlocation/make/model/creation_time. - Encode
Plan - The encode plan — the result of
Engine::plan. Usable for--dry-run. - Encode
Spec - The full encode recipe.
- Media
Info - Source file metadata — the result of
Engine::probe. - Outcome
- The execution result — the result of
Engine::run. - Shrink
Opts - Compression options passed to the engine — the decoded form of the flags.
- Video
Spec - Video encoding parameters.
Enums§
- Engine
Error - Engine errors.
- Hdr
- HDR transfer function of a source video.
- Size
Goal - What the user wants in terms of size.
Constants§
- MIN_
SAVING - A quality-mode re-encode has to save at least this share of the source to be worth it; below that the original is kept. A minutes-long 4K encode for a 1 % saving isn’t a compression — just a generation of quality loss.
Traits§
- Engine
- The compression engine contract. The one v0.1 implementation is
media::MediaEngine.
Functions§
- not_
worth_ it - Whether a result of
expectedbytes isn’t worth producing for asourceofsourcebytes (saves less thanMIN_SAVING). The guard, dry runs and UI previews all ask this, so a preview and the run agree.