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

broadwayjs

v0.0.2

Published

A JavaScript H.264 decoder

Downloads

160

Readme

Broadway.js

A JavaScript H.264 decoder.

npm install broadwayjs

View a Live Demo:
http://mbebenita.github.io/Broadway/foxDemo.html
http://mbebenita.github.io/Broadway/storyDemo.html
http://mbebenita.github.io/Broadway/treeDemo.html

The video player first needs to download the entire video before it can start playing, thus appearing to be a bit slow at first, so have patience. You can start the video by clicking on each player. The top left player runs on the main thread, the remaining players run in background worker threads.

See example folder for example app.

Technical info

The demo is Android's H.264 decoder compiled with Emscripten to JavaScript, then further optimized with Google's JavaScript closure compiler and further optimized by hand to use WebGL.

Building the demo:

Install and configure Emscripten (https://github.com/kripken/emscripten)
The current version of Broadway was built with emscripten 1.35.12

The code for the demo is in the Decoder folder, to build it run the make.py python script. (Requires at least python 2.7)

Encoding Video

The decoder expects an .mp4 file and does not support weighted prediction for P-frames and CABAC entropy encoding. To create such bitstreams use ffmpeg and x264 with the following command line options:

ffmpeg -y -i sourceFile -r 30000/1001 -b:a 2M -bt 4M -vcodec libx264 -pass 1 -coder 0 -bf 0 -flags -loop -wpredp 0 -an targetFile.mp4

API

Player.js, Decoder.js and YUVWebGLCanvas.js all have a unified module definition.
You can use them as plain js files or with common.js / AMD

#Player.js:

var p = new Player({
  <options>
});

p.canvas; // the canvas - put it where you want it

p.decode(<h264 data>);

##options:

useWorker true / false
decode in a worker thread

workerFile
path to Decoder.js. Only neccessary when using worker. defaults to "Decoder.js"

webgl true / "auto" / false
use webgl. defaults to "auto"

size { width: , height: }
initial size of the canvas. canvas will resize after video starts streaming.

##properties:

canvas
domNode

refers to the canvas element.

##methods:

decode ()

feed the decoder with h264 stream data.

#Decoder.js:

var p = new Decoder({
  <options>
});

p.onPictureDecoded; // override with a callback function

p.decode(<h264 data>);

##options:

rgb true / false
if true will convert the image to rgb. sligtly slower.

##properties:

onPictureDecoded callback function(, width, height)

will be called for each frame.

##methods:

decode ()

feed the decoder with h264 stream data.

#Real World Uses of Broadway.js