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

PresetOutput resolutionBase resolutionBase networkFrame cadenceNamed shortcut
xs384×216128×72Small1-in-3 framesfast
small384×216192×108Small1-in-2 frames
medium512×288256×144Large1-in-2 framesbalanced
large640×360256×144Largeevery frame
xl1280×720320×180XLevery framequality

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. preset and autotune here govern the video model only. When audio: '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 pick dfn / 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:

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