Registry / serialization / ebml-block

ebml-block

JSON →
library1.1.2jsnpmunverified

ebml-block is a specialized JavaScript library designed to parse the raw binary data of an EBML Block or SimpleBlock structure. These blocks typically contain actual media frames (video, audio) and their associated metadata, such as timecodes and keyframe indicators, commonly found within Matroska (MKV) and WebM container formats. The package's current stable version is 1.1.2, released in March 2017. While functional, its development has been dormant since then, suggesting a maintenance-only status rather than active feature development. It is crucial to note that ebml-block does not parse entire EBML documents; instead, it expects a pre-extracted Buffer representing a single Block element. This differentiates it from broader EBML parsers, making it a low-level utility for processing specific data chunks within a larger EBML stream, often used in conjunction with a full EBML stream decoder.

npm install ebml-block
INSTALL
IMPORT
SIG · EBML-BLOCK
E
ebml-block
serializationjavascriptv1.1.2
Install
Import
Disk
Pass rate
0/ 6
Env Coverage0 / 6
glibc
1822
musl
1822
Install & Compatibility
Where this runs
tested against v? · npm install
Install × environment matrix
Each cell = how many times install + import succeeded across repeated harness runs. Partial = flaky.
glibc = Debian/Ubuntu slim · musl = Alpine Linux
musl
node 18226 runs
build_error
glibc
node 18226 runs
build_error
Code
Verified usage

Verified import paths — ran on the pinned version, not inferred.

ebmlBlock
const ebmlBlock = require('ebml-block')
import ebmlBlock from 'ebml-block'
The package is primarily designed for CommonJS environments as indicated by its last update in 2017. While ESM import might work with tooling, 'require' is the canonical usage.
ebmlBlock
import ebmlBlock from 'ebml-block'
import { ebmlBlock } from 'ebml-block'
Assuming ESM compatibility and that the package exports a default function. It does not appear to have named exports based on its CJS usage pattern.

Demonstrates how to use `ebml-block` in conjunction with the `ebml` package to parse individual EBML Block or SimpleBlock elements from a Matroska (MKV) file stream, extracting their structured data like timecodes and frames.

const fs = require('fs'); const ebml = require('ebml'); // Required for decoding the overall EBML stream const ebmlBlock = require('ebml-block'); // The library: parses the raw Block data // Initialize an EBML Decoder from the 'ebml' package. // This decoder processes the high-level EBML structure of a file like .mkv or .webm. const decoder = new ebml.Decoder(); // Listen for 'data' events. Each 'chunk' represents an EBML element found. decoder.on('data', function (chunk) { // We're interested in 'Block' or 'SimpleBlock' elements, which contain // the actual video/audio frame data along with metadata like timecodes. if (chunk[1].name === 'Block' || chunk[1].name === 'SimpleBlock') { // The 'data' property of the element is a Buffer containing the raw block. // Pass this Buffer to ebmlBlock for detailed parsing. const block = ebmlBlock(chunk[1].data); console.log('Parsed EBML Block:', block); console.log(` Track Number: ${block.trackNumber}`); console.log(` Timecode (ms): ${block.timecode}`); console.log(` Keyframe: ${block.keyframe}`); console.log(` Number of frames in block: ${block.frames.length}`); } }); decoder.on('error', (err) => { console.error('EBML Decoder encountered an error:', err.message); }); decoder.on('end', () => { console.log('Finished processing EBML stream.'); }); // To run this, ensure 'media.mkv' exists in the current directory or provide a valid path. // This pipes an MKV file stream through the EBML decoder. // The decoder then emits 'data' events for ebml-block to process. fs.createReadStream('media.mkv').pipe(decoder);
Debug
Known issues
gotcha`ebml-block` is a low-level parser for individual EBML `Block` or `SimpleBlock` data buffers, not a full EBML document parser. It will not process an entire `.mkv` or `.webm` file; it expects only the data payload of a block element.
fix
Use a higher-level EBML parser (e.g., `ebml` package) to extract `Block` or `SimpleBlock` element data, then pass that data to `ebml-block`.
affects: >=1.0.0
gotchaThe library has not seen active development since March 2017 (v1.1.2). While it remains functional for its specific purpose, it may not be actively maintained, potentially lacking updates for newer Node.js features, performance optimizations, or security patches.
fix
Evaluate its suitability for critical applications or consider alternatives if active maintenance is a requirement. Thoroughly test in your target environment.
affects: >=1.0.0
gotcha`ebml-block` relies on the `ebml` package (or a similar EBML stream parser) to correctly identify and extract the `Block` or `SimpleBlock` elements from an EBML stream. Installing and using `ebml` is a prerequisite for typical usage.
fix
Ensure `npm install ebml` is run and the `ebml.Decoder` is used to preprocess the stream before feeding block data to `ebml-block`.
affects: >=1.0.0
Errors
Common errors & fixes
ReferenceError: ebml is not defined
The `ebml` peer dependency, essential for extracting EBML block data from a stream, was not imported or installed.
fix
Install `ebml` (`npm install ebml`) and ensure it's imported in your code (`const ebml = require('ebml');`).
TypeError: ebmlBlock is not a function
The `ebml-block` package was not correctly imported or required, or the imported object does not expose the expected parsing function directly.
fix
For CommonJS, use `const ebmlBlock = require('ebml-block');`. For ESM, use `import ebmlBlock from 'ebml-block;'` (assuming it provides a default export, though the package is CJS).
Error: No such file or directory, open 'media.mkv'
The `fs.createReadStream()` call in the quickstart example cannot find the specified media file.
fix
Ensure 'media.mkv' exists in the current working directory, or update the path to point to a valid Matroska/WebM file.
Upgrade
Version history
1.1.2latest on npm
Audit
Dependencies
ebmlrequiredRequired to decode the overall EBML stream and extract individual Block or SimpleBlock elements, whose raw data is then processed by ebml-block.
Agent activity
4 hits · last 30 days
node
4
Resources
ebml-block — npm install ebml-block · libregistry