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 🙏

© 2024 – Pkg Stats / Ryan Hefner

h264decoder

v1.0.0

Published

Just an H.264 video decoder.

Downloads

2,166

Readme

H264 Decoder

Just an H264 decoder. That's all. Usable in the browser & node.

This project is based on the WebAssembly H264 decoder from TinyH264Decoder. Some unnecessary WASM functions have been stripped out, and the JS wrapper simplified. The WebAssembly module is inlined as a Base64-encoded string, so now special loading provisions are necessary. Just import { H264Decoder } from 'h264decoder'; and go. If you want to run it in a worker or a subprocess, that's up to you.

Create a new decoder with new H264Decoder();.

H264Decoder objects have a single public method: decoder.decode(nalu: Uint8Array): number. Input is expected in the form of single, complete, pre-segmented H264 Network Abstraction Layer Units (NALUs). Input is expected to be complete NALs (access units) as Uint8Array, the output result is a yuv420 buffer as Uint8Array. The return value is a number from the set

H264Decoder.RDY = 0;
H264Decoder.PIC_RDY = 1;
H264Decoder.HDRS_RDY = 2;
H264Decoder.ERROR = 3;
H264Decoder.PARAM_SET_ERROR = 4;
H264Decoder.MEMALLOC_ERROR = 5;

When decoder.decode(nalu) returns PIC_RDY, an output frame can be accessed through decoder.pic as a Uint8Array of YUV420 data. You are on your own for converting that to RGB if you like. The frame dimensions can be accessed through decoder.width and decoder.height. The array returned through decoder.pic aliases internal data structures to minimize unnecessary data copying--treat it as read-only and don't mess with it! If you need to do any further processing on the image, write to a separate buffer.

There are no cleanup or reset operations. If you are done decoding a particular stream, it is expected that you will simply discard the entire decoder and create a new one as needed.