{"id":29146143,"url":"https://github.com/mathiasvr/matroska-subtitles","last_synced_at":"2025-06-30T21:10:32.915Z","repository":{"id":41493422,"uuid":"62330265","full_name":"mathiasvr/matroska-subtitles","owner":"mathiasvr","description":"💬 Streaming parser for embedded .mkv subtitles.","archived":false,"fork":false,"pushed_at":"2023-01-06T14:45:34.000Z","size":2036,"stargazers_count":46,"open_issues_count":12,"forks_count":10,"subscribers_count":3,"default_branch":"master","last_synced_at":"2025-06-10T22:52:46.267Z","etag":null,"topics":["matroska","mkv","parser","seeking","stream","subtitles"],"latest_commit_sha":null,"homepage":"","language":"JavaScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/mathiasvr.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2016-06-30T17:33:46.000Z","updated_at":"2025-06-04T15:39:34.000Z","dependencies_parsed_at":"2023-02-06T05:31:00.676Z","dependency_job_id":null,"html_url":"https://github.com/mathiasvr/matroska-subtitles","commit_stats":null,"previous_names":[],"tags_count":18,"template":false,"template_full_name":null,"purl":"pkg:github/mathiasvr/matroska-subtitles","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/mathiasvr%2Fmatroska-subtitles","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/mathiasvr%2Fmatroska-subtitles/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/mathiasvr%2Fmatroska-subtitles/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/mathiasvr%2Fmatroska-subtitles/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/mathiasvr","download_url":"https://codeload.github.com/mathiasvr/matroska-subtitles/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/mathiasvr%2Fmatroska-subtitles/sbom","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":261200336,"owners_count":23123944,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["matroska","mkv","parser","seeking","stream","subtitles"],"created_at":"2025-06-30T21:10:32.118Z","updated_at":"2025-06-30T21:10:32.875Z","avatar_url":"https://github.com/mathiasvr.png","language":"JavaScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# matroska-subtitles\n\n[![NPM](https://img.shields.io/npm/v/matroska-subtitles.svg?style=for-the-badge)](https://npm.im/matroska-subtitles)\n![Downloads](https://img.shields.io/npm/dt/matroska-subtitles.svg?style=for-the-badge)\n![Dependency status](https://img.shields.io/librariesio/release/npm/matroska-subtitles?style=for-the-badge)\n[![License](https://img.shields.io/:license-MIT-blue.svg?style=for-the-badge)](https://mvr.mit-license.org)\n[![forthebadge](https://forthebadge.com/images/badges/powered-by-coffee.svg)](https://forthebadge.com)\n\nStreaming parser for embedded .mkv subtitles.\n\nSupported formats: `.srt`, `.ssa`, `.ass`.\n\n## install\n\n```shell\n$ npm install matroska-subtitles\n```\n\nor include it directly:\n```html\n\u003cscript src=\"https://cdn.jsdelivr.net/npm/matroska-subtitles@3.x/dist/matroska-subtitles.min.js\"\u003e\u003c/script\u003e\n```\n\n## example\n\n```js\nconst fs = require('fs')\nconst { SubtitleParser } = require('matroska-subtitles')\n\nconst parser = new SubtitleParser()\n\n// first an array of subtitle track information is emitted\nparser.once('tracks', (tracks) =\u003e console.log(tracks))\n\n// afterwards each subtitle is emitted\nparser.on('subtitle', (subtitle, trackNumber) =\u003e\n  console.log('Track ' + trackNumber + ':', subtitle))\n\nfs.createReadStream('Sintel.2010.720p.mkv').pipe(parser)\n```\n\nSee [examples](https://github.com/mathiasvr/matroska-subtitles/tree/master/examples) folder for more examples.\n\n### `tracks` event response format\n\n```js\n[\n  { number: 3, language: 'eng', type: 'utf8', name: 'English(US)' },\n  { number: 4, language: 'jpn', type: 'ass', header: '[Script Info]\\r\\n...' }\n]\n```\n\n- The `language` attribute can be `undefined` if the mkv track does not specify it, this is often interpreted as `eng`.\n- The `name` attribute is not standard but may provide language info.\n\n### `subtitle` event response format\n\n```js\n{\n  text: 'This blade has a dark past.',\n  time: 107250,  // ms\n  duration: 1970 // ms\n}\n```\n\n## attached files\nThe parser now also has a `file` event that emits embedded mkv files, mainly to be used to extract embedded subtitle fonts.\n\n```js\nparser.on('file', file =\u003e console.log('file:', file))\n```\n\nOutput:\n```js\n{\n  filename: 'Arial.ttf',\n  mimetype: 'application/x-truetype-font',\n  data: Buffer() [Uint8Array]\n}\n```\n\n## random access\nThis module also includes a `SubtitleStream` class for intercepting subtitles\nin mkv streams with support for seeking.\n\n```js\nconst { SubtitleStream } = require('matroska-subtitles')\n\nlet subtitleStream = new SubtitleStream()\n\nsubtitleStream.once('tracks', (tracks) =\u003e {\n  // close the old subtitle stream and open a new at a different stream offset\n  subtitleStream = new SubtitleStream(subtitleStream)\n})\n```\n\nSee [examples/random-access.js](examples/random-access.js) for a detailed example.\n\n## see also \n\n[mkv-subtitle-extractor](https://npm.im/mkv-subtitle-extractor)\n\n## license\n\nMIT\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmathiasvr%2Fmatroska-subtitles","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fmathiasvr%2Fmatroska-subtitles","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmathiasvr%2Fmatroska-subtitles/lists"}