All Projects → node-ebml → Node Ebml

node-ebml / Node Ebml

Licence: mit
EBML parser

Programming Languages

javascript
184084 projects - #8 most used programming language

Projects that are alternatives of or similar to Node Ebml

Pm2 Slack
A PM2 module to emit events to Slack
Stars: ✭ 124 (+87.88%)
Mutual labels:  node-module, nodejs-modules
Mastodon Api
Mastodon API Client Library
Stars: ✭ 89 (+34.85%)
Mutual labels:  node-module, nodejs-modules
Meetup Api
meetup-api is an Meetup.com API library written in JavaScript for Node.js V8 and Node.js ChakraCore
Stars: ✭ 104 (+57.58%)
Mutual labels:  node-module, nodejs-modules
Openwrt Node Packages
OpenWrt Project Node.js packages. v10.x LTS and v12.x LTS and v14.x LTS
Stars: ✭ 176 (+166.67%)
Mutual labels:  node-module, nodejs-modules
vayder
Easy and concise validations for Express routes
Stars: ✭ 26 (-60.61%)
Mutual labels:  node-module, nodejs-modules
Modclean
Remove unwanted files and directories from your node_modules folder
Stars: ✭ 309 (+368.18%)
Mutual labels:  node-module, nodejs-modules
node-screenlogic
Pentair ScreenLogic Javascript library using Node.JS
Stars: ✭ 38 (-42.42%)
Mutual labels:  node-module, nodejs-modules
Docx Builder
NPM Module for creating or merging .docx files
Stars: ✭ 11 (-83.33%)
Mutual labels:  node-module, nodejs-modules
Quadtree Js
A simple quadtree implementation for javascript and typescript (nodejs or browser).
Stars: ✭ 36 (-45.45%)
Mutual labels:  node-module
Awesome Node Utils
some useful npm packages for nodejs itself
Stars: ✭ 51 (-22.73%)
Mutual labels:  node-module
Catchart
Pipe something from command line to a chart in the browser
Stars: ✭ 27 (-59.09%)
Mutual labels:  nodejs-modules
Is
Type check values
Stars: ✭ 1,011 (+1431.82%)
Mutual labels:  node-module
Ar Gif
Easy to use augmented reality web components
Stars: ✭ 52 (-21.21%)
Mutual labels:  webm
Peek
Peek makes it easy to create short screencasts of a screen area. It was built for the specific use case of recording screen areas, e.g. for easily showing UI features of your own apps or for showing a bug in bug reports. With Peek, you simply place the Peek window over the area you want to record and press "Record". Peek is optimized for generating animated GIFs, but you can also directly record to WebM or MP4 if you prefer.
Stars: ✭ 8,408 (+12639.39%)
Mutual labels:  webm
Electron Progressbar
electron-progressbar provides an easy-to-use and highly customizable API to show and control progress bars on Electron applications.
Stars: ✭ 58 (-12.12%)
Mutual labels:  nodejs-modules
Ad Bs Converter
A javascript implementation to convert bikram samvat to anno domini and vice-versa
Stars: ✭ 20 (-69.7%)
Mutual labels:  node-module
Flexsearch
Next-Generation full text search library for Browser and Node.js
Stars: ✭ 8,108 (+12184.85%)
Mutual labels:  node-module
Trymodule
➰ It's never been easier to try nodejs modules!
Stars: ✭ 1,115 (+1589.39%)
Mutual labels:  nodejs-modules
String Hash
Get the hash of a string
Stars: ✭ 56 (-15.15%)
Mutual labels:  node-module
Hexo Auto Category
Generate categories automatically for each post in Hexo
Stars: ✭ 49 (-25.76%)
Mutual labels:  node-module

EBML Build Status NPM Coverage Status Greenkeeper badge

EBML stands for Extensible Binary Meta-Language and is somewhat of a binary version of XML. It's used for container formats like WebM or MKV.

Note

This is for version 3.0.0 and up, which has undergone a massive rewrite and now builds with RollupJS.

Version 2.2.4 is the last version to have guaranteed legacy semantics.

Install

Install via NPM or Yarn:

npm install ebml --save
# or
yarn add ebml

Usage

The Decoder() class is implemented as a Node Transform stream. As input it takes EBML. As output it emits a sequence of chunks: two-element arrays looking like this example.

[ "tag",
  {
    name: "TimecodeScale",
    type: "u",
    value: 1000000
   }
 ]

The first element of the array is a short text string. For tags containing values, like this example, the string is 'tag'. ebml also has nesting tags. The opening of those tags has the string 'start' and the closing has the string 'end'. Integers stored in 6 bytes or less are represented as numbers, and longer integers are represented as hexadecimal text strings.

The second element of the array is an object with these members, among others:

  • name is the Matroska Element Name.
  • type is the data type.
    • u: unsigned integer. Some of these are UIDs, coded as 128-bit numbers.
    • i: signed integer.
    • f: IEEE-754 floating point number.
    • s: printable ASCII text string.
    • 8: printable utf-8 Unicode text string.
    • d: a 64-bit signed timestamp, in nanoseconds after (or before) 2001-01-01T00:00UTC.
    • b binary data, otherwise uninterpreted.
  • value is the value of the data in the element, represented as a number or a string.
  • data is the binary data of the entire element stored in a Uint8Array.

Elements with the Block and SimpleBlock types get special treatment. They have these additional members:

  • payload is the coded information in the element, stored in a Uint8Array.
  • track is an unsigned integer indicating the payload's track.
  • keyframe is a Boolean value set to true if the payload starts an I frame (SimpleBlocks only).
  • discardable is a Boolean value showing the value of the element's Discardable flag. (SimpleBlocks only).

And the value member shows the block's Timecode value.

Examples

This example reads a media file into memory and decodes it. The decoder invokes its data event for each Element.

const fs = require('fs');
const { Decoder } = require('./lib/ebml.js');

const decoder = new Decoder();

decoder.on('data', chunk => console.log(chunk));

fs.readFile('media/test.webm', (err, data) => {
    if (err) {
        throw err;
    }
    decoder.write(data);
});

This example does the same thing, but by piping the file stream into the decoder (a Transform stream).

const { Decoder } = require('./lib/ebml.js');

const ebmlDecoder = new Decoder();
const counts = {};

require('fs')
    .createReadStream('media/test.webm')
    .pipe(ebmlDecoder)
    .on('data', chunk => {
        const { name } = chunk[1];
        if (!counts[name]) {
            counts[name] = 0;
        }
        counts[name] += 1;
    })
    .on('finish', () => console.log(counts));

State of this project

Parsing should work. If it doesn't, please create an issue.

d-type elements (timestamps) are not yet decoded to Javascript timestamp values.

Thanks to @chrisprice we got an encoder!

License

MIT

Contributors

(in alphabetical order)

Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].