Skip to content

Options and errors ​

Looking around and reframing ​

createViewer(canvas) draws flat views of a <video> on a WebGPU canvas (also from @bvdmitri/web360/view, without the stitcher), and createReframer({ width, height }) turns decoded 360 frames into flat ones for export. A View is a pan, tilt, roll, field of view and lens distance; viewAt(keyframes, time) follows a smooth path between keyframed views. See Looking around and reframing.

Options ​

  • width: the output width in pixels; the height is half.
  • from, to: the span to render, in seconds of the recording (the whole recording by default).
  • stabilization: smooth (the default: a level horizon facing the camera's heading smoothed both ways in time), lock (fixed in the world), horizon (level, facing where the camera faces), follow (the camera's motion smoothed, tilt included) or off.
  • smoothing: the time constant of smooth and follow, in seconds (1 by default).
  • gainMatching: match the lenses' exposure and colour across the seam, re-measured as the video goes (on by default; a GoPro has matched its own).
  • signal: an AbortSignal that stops the rendition.
  • platform: where decoding, rendering and presenting happen; the browser's by default (browserPlatform()). A test supplies its own to run a rendition outside a browser.

rendition.metadata gives the recording's duration in seconds and its camera model; rendition.duration is the span's length.

Errors ​

Opening or rendering throws a Web360Error whose code says why:

CodeMeaning
missing-second-filea split recording was opened without its other lens file
unreadable-recordingthe files are not a recording web360 reads
render-unavailablethe browser has no WebGPU
webcodecs-unavailablethe browser has no WebCodecs
codec-unsupportedthe browser cannot decode the recording's video
decodedecoding failed partway

Requirements ​

A browser with WebGPU and WebCodecs (current Chrome and Edge; Safari as its WebGPU matures). Run it in a dedicated Web Worker so stitching never blocks the page.

Cameras ​

The Insta360 ONE R (5.7K 360 lens) is measured: its lens field of view, its IMU alignment and its rolling shutter come from real footage. Other Insta360 bodies open and stitch with the ONE R's values until footage from them sets their own.

The GoPro MAX2 is measured: its cube-map layout, the alignment of its gyro to the picture and its telemetry delay come from real footage, and it is stabilized by its gyro, levelled by the gravity it records. The original MAX opens with the MAX2's values until footage from it sets its own. A GoPro's 8K video needs a browser that decodes HEVC at that size.

Released under the MIT License.