Skip to content

Getting Started

To install the decoder:

Terminal window
npm i unbikit

To use it:

import { createBikDecoder, type BikFrame } from "unbikit";
const decoder = await createBikDecoder(new URL("/some/source/of/video.bik"));
let frame: BikFrame | null;
while ((frame = await decoder?.getNextFrame())) {
// ... process frame
}

Decoding should be performed off the main thread where possible (in a Web Worker, Worker thread or similar).

The frames returned by the decoder have their image data encoded in Planar YUV 4:2:0 format, with an optional alpha channel. They will usually need to be converted to RGB(A) format before they can be displayed on-screen.

The VideoFrame object (baseline since 2024) can be used in web browsers to aid with conversion between video encoding formats. Alternatively, a straightforward (but relatively slow) function for converting Planar YUV 4:2:0 format to RGB(A) can be found in the unbikit demo. See the yuv420PlanarToRgb() function in the demo source code.