npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2026 – Pkg Stats / Ryan Hefner

@yume-chan/h264bsd

v1.1.1

Published

WebAssembly build of Android H264BSD decoder

Readme

@yume-chan/h264bsd

A WebAssembly H.264 Decoder.

A recompilation of https://github.com/oneam/h264bsd and https://github.com/udevbe/tinyh264, with modern ESM wrapper and TypeScript definition.

| | TinyH264 | This library | | ------------ | --------- | ------------ | | Size | 184KB | 165KB | | CPU Usage * | 300%~350% | 50%~60% |

* Decoding a 3200x1440@90FPS video. I did nothing, I have no idea where the performance diff come from

Profile

Only Baseline profile is supported.

Usage

import YUVCanvas from "yuv-canvas";

import type { Decoder, Picture } from "@yume-chan/h264bsd";
import initialize from "@yume-chan/h264bsd";

declare const canvas: HTMLCanvasElement | OffscreenCanvas;
declare const webGl = true;
const Renderer: YUVCanvas = YUVCanvas.attach(canvas, { webGL: webGl });

function drawPicture(picture: Picture) {
  const width = picture.info.picWidth;
  const height = picture.info.picHeight;

  const chromaWidth = width / 2;
  const chromaHeight = height / 2;

  const uOffset = width * height;
  const vOffset = uOffset + chromaWidth * chromaHeight;

  Renderer.drawFrame({
    format: {
      width,
      height,
      chromaWidth,
      chromaHeight,
      cropLeft: picture.info.cropParams.cropLeftOffset,
      cropWidth: picture.info.cropParams.cropOutWidth,
      cropTop: picture.info.cropParams.cropTopOffset,
      cropHeight: picture.info.cropParams.cropOutHeight,
      displayWidth: picture.info.cropParams.cropOutWidth,
      displayHeight: picture.info.cropParams.cropOutHeight,
    },
    y: {
      bytes: picture.bytes.subarray(0, uOffset),
      stride: width,
    },
    u: {
      bytes: picture.bytes.subarray(uOffset, vOffset),
      stride: chromaWidth,
    },
    v: {
      bytes: picture.bytes.subarray(vOffset),
      stride: chromaWidth,
    },
  });
}

const Module = await initialize();
const Decoder: Decoder = new Module.Decoder();

let picId = 0;
export function decode(data: Uint8Array) {
  // Each `data` must be one or multiple complete NAL units
  const result = Decoder.decode(data, picId);
  picId += 1;

  // `picture`s reference internal memory
  // They are valid until next `decode` call
  // They don't need to be released
  if (result.picture) {
    // If frame reordering is enabled,
    // `result.picture.picId` might not equal to current `picId` in `decode` call
    console.log(result.picture.picId);

    drawPicture(result.picture);

    // If frame reordering is enabled,
    // one `decode` call might return multiple pictures
    for (let i = 0; i < result.extraPictureCount; i += 1) {
      drawPicture(decoder.getNextPicture());
    }
  }
}

export function dispose() {
  Decoder.delete();
}