{"library":"matroska","title":"Matroska Node Parser","description":"The `matroska` package provides a Node.js library for parsing Matroska (MKV), WebM, and EBML streams and files. It is a fork of `node-ebml`, emphasizing fast parsing with an option for incomplete metadata extraction (info tags and attachments) or a complete parse of the entire document structure. The current stable version is 2.2.5, with its last publish approximately three years ago, indicating a maintenance-focused release cadence rather than active feature development. Recent updates have included fixes for `cueClusterPosition` problems and improved resilience when handling invalid MKV formats, alongside stream support introduced in older versions. Its key differentiators include its speed and the ability to process potentially malformed Matroska files, making it suitable for applications that require robust media metadata extraction in a Node.js environment.","language":"javascript","status":"maintenance","last_verified":"Sun Apr 19","install":{"commands":["npm install matroska"],"cli":null},"imports":["const { Decoder } = require('matroska');","const { Decoder } = require('matroska'); Decoder.parseInfoTagsAndAttachments(url, callback);","const matroska = require('matroska');"],"auth":{"required":false,"env_vars":[]},"quickstart":{"code":"const matroska = require('matroska');\nconst url = 'http://download.wavetlan.com/SVV/Media/HTTP/mkv/H264_mp3(mkvmerge).mkv';\n\nconst decoder = new matroska.Decoder();\ndecoder.parse(url, function(error, document) {\n\tif (error) {\n\t\tconsole.error('Error parsing Matroska file:', error);\n\t\treturn;\n\t}\n\n\tconsole.log('Successfully parsed Matroska document:');\n\t// The document object represents the parsed Matroska structure.\n\t// You can access its properties, e.g., document.print() for a tree representation.\n\tconsole.log(document.print());\n\tconsole.log('\\nExtracted Info:');\n\tconst info = document.findTag('Info'); // Assuming a method to find tags, or traverse the document tree\n\tif(info) {\n\t  console.log('Timecode Scale:', info.findTag('TimecodeScale')?.value);\n\t  console.log('Muxing App:', info.findTag('MuxingApp')?.value);\n\t  console.log('Duration:', info.findTag('Duration')?.value);\n\t} else {\n\t  console.log('Info tag not found in document.');\n\t}\n});","lang":"javascript","description":"This code demonstrates how to perform a complete parse of a Matroska (MKV) file from a URL using the `Decoder` class and its `parse` method, logging the full document structure and extracting some common info tags.","tag":null,"tag_description":null,"last_tested":null,"results":[]},"compatibility":null}