Presets & autotune
Longpipe ships five model presets covering different speed/quality tradeoffs. The default ('auto') picks one for the user’s hardware automatically. All five run a temporal head (ConvGRU) for frame-to-frame stability.
The presets
| Preset | Output resolution | Base resolution | Base network | Frame cadence | Named shortcut |
|---|---|---|---|---|---|
xs | 384×216 | 128×72 | Small | 1-in-3 frames | fast |
small | 384×216 | 192×108 | Small | 1-in-2 frames | — |
medium | 512×288 | 256×144 | Large | 1-in-2 frames | balanced |
large | 640×360 | 256×144 | Large | every frame | — |
xl | 1280×720 | 320×180 | XL | every frame | quality |
Output resolution is where the matte is produced and composited (the network’s refinement input); base resolution is what the encoder runs at internally (the wrapper strides the input down to it). Frame cadence is how often the model re-runs — skipped frames reuse the previous matte while still compositing every frame, so a 1-in-2 preset costs roughly half the per-source-frame inference of an every-frame one.
large is the design reference tier; the others sit around it as cheaper/heavier variants. Weights are f16 on hardware that supports it (most WebGPU + WebGL2), f32 otherwise — the runtime decides, regardless of preset. All tiers are trained on the same data and exported with the same op fusions. See MODEL_PLAN.md in the repo for architecture details.
The three named shortcuts — 'fast', 'balanced', 'quality' — map to xs, medium, xl respectively.
Autotune (preset: 'auto')
On init, the worker microbenchmarks the candidate presets on the real device and picks the largest one whose measured per-frame model cost fits the frame budget — roughly half of a 30fps source frame (~16 ms; WebGL is more conservative, since it has no live upgrade path). The benchmark uses zero-filled weights of the correct shapes (GPU cost is shape-driven), so it runs before any weights are fetched.
Autotune runs once at startup and adds a small amount to init time for the sweep.
Audio denoise auto-selects separately.
presetand autotune here govern the video model only. Whenaudio: 'denoise'is set, the denoiser runs its own analogous weight-free probe at init — timing the denoise network on the device (no weights downloaded) to pickdfn/dfnint8/rnnoise— independent of the video preset. See Audio denoise → Models.
Adaptive (runtime)
When preset: 'auto' and adaptive: true (the default), Longpipe also adjusts at runtime:
- Downgrade if the actual framerate drops below the target (typically because another tab started doing heavy work, the user plugged into a battery-saver power plan, etc.).
- Upgrade if
modelMsshows consistent headroom (WebGPU only — WebGL upgrades are too expensive to be worth doing live).
Disable with adaptive: false.
Pinning a preset
new EffectsPipeline(stream, { preset: 'large' }) // disables autotune & adaptive
new EffectsPipeline(stream, { preset: 'auto', adaptive: false }) // autotune once, then stay