Screen helpers · function
exportSizeExact
The size asked for, evened — for an encode whose schedule is ours.
Explained in Recording and clips.
function exportSizeExact(width: number, height: number): ExportSizeimport { exportSizeExact } from '@driftengine/core';Parameters
| Parameter | Type | Description |
|---|---|---|
width | number | |
height | number |
In depth
The counterpart to exportSizeFor, and the distinction is the whole point.
exportSizeFor trades pixels for frame rate, which is the right trade for a
real-time recorder: MediaRecorder stamps by wall clock, so a device that
cannot draw an export-size frame in 16 ms produces a worse file, and a
smaller frame it can hold is the better clip.
An offline encode makes no such trade, because it has no clock to lose to.
Every frame is stamped with where it belongs (see frameTimestampUs), so a
device that needs 40 ms a frame produces the same file as one that needs 4 —
it just waits longer for it. Reducing there buys nothing but a shorter wait,
and it is paid for in the one thing the clip is for.
That mattered most on exactly the devices least able to argue: the reduction
gate is measuredFps × windowPixels / exportPixels ≥ targetFps × 1.15, which
at a vsync-capped 60 fps needs a drawing buffer of 2.38 Mpx to clear. A phone
has about 1.5 Mpx (a ~412×915 viewport at a DPR capped to 2), so no 60 Hz
phone could ever earn the full frame: every mobile clip came out 720×1280 at
6.1 Mbit/s where a desktop's was 1080×1920 at 13.7. Same shot, same 60 fps,
a quarter of the detail — which gets reported as a difference in "graphics
detail" rather than in frame rate. It was neither; it was pixels.
Both dimensions stay even, for the same reason as below.