Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

matroska-subtitles

Package Overview
Dependencies
Maintainers
1
Versions
20
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

matroska-subtitles - npm Package Compare versions

Comparing version 2.0.4 to 3.0.0

dist/matroska-subtitles.js

33

package.json
{
"name": "matroska-subtitles",
"version": "2.0.4",
"description": "Writable stream for parsing embedded .mkv subtitles.",
"main": "index.js",
"files": [
"lib"
],
"version": "3.0.0",
"description": "Streaming parser for embedded .mkv subtitles.",
"source": "src/index.js",
"main": "dist/matroska-subtitles.js",
"module": "dist/matroska-subtitles.module.js",
"unpkg": "dist/matroska-subtitles.umd.js",
"dependencies": {
"ebml": "^2.2.0",
"ebml-block": "^1.1.0"
"ebml": "^3.0.0",
"ebml-block": "^1.1.2",
"readable-stream": "^3.6.0"
},
"devDependencies": {},
"devDependencies": {
"dev-null": "^0.1.1",
"microbundle": "^0.12.3",
"standard": "*"
},
"scripts": {
"test": "standard"
"test": "standard && node tests/test.js",
"build": "microbundle --name=MatroskaSubtitles",
"prepare": "npm run build",
"prepublishOnly": "npm test"
},

@@ -37,3 +45,6 @@ "keywords": [

"example": "examples"
}
},
"files": [
"dist"
]
}

@@ -1,11 +0,9 @@

# matroska-subtitles [![npm][npm-img]][npm-url] [![dependencies][dep-img]][dep-url] [![license][lic-img]][lic-url]
# matroska-subtitles
[npm-img]: https://img.shields.io/npm/v/matroska-subtitles.svg
[npm-url]: https://www.npmjs.com/package/matroska-subtitles
[dep-img]: https://david-dm.org/mathiasvr/matroska-subtitles.svg
[dep-url]: https://david-dm.org/mathiasvr/matroska-subtitles
[lic-img]: http://img.shields.io/:license-MIT-blue.svg
[lic-url]: http://mvr.mit-license.org
[![npm](https://img.shields.io/npm/v/matroska-subtitles.svg)](https://npm.im/matroska-subtitles)
![downloads](https://img.shields.io/npm/dt/matroska-subtitles.svg)
[![dependencies](https://david-dm.org/mathiasvr/matroska-subtitles.svg)](https://david-dm.org/mathiasvr/matroska-subtitles)
[![license](https://img.shields.io/:license-MIT-blue.svg)](https://mvr.mit-license.org)
Writable stream for parsing embedded .mkv subtitles.
Streaming parser for embedded .mkv subtitles.

@@ -16,6 +14,11 @@ Supported formats: `.srt`, `.ssa`, `.ass`.

```bash
npm install matroska-subtitles
```shell
$ npm install matroska-subtitles
```
or include it directly:
```html
<script src="https://unpkg.com/matroska-subtitles@3.0.0"></script>
```
## example

@@ -25,16 +28,14 @@

const fs = require('fs')
const MatroskaSubtitles = require('matroska-subtitles')
const { SubtitleParser } = require('matroska-subtitles')
var parser = new MatroskaSubtitles()
const parser = new SubtitleParser()
// first an array of subtitle track information is emitted
parser.once('tracks', function (tracks) {
console.log(tracks)
})
parser.once('tracks', (tracks) => console.log(tracks))
// afterwards each subtitle is emitted
parser.on('subtitle', function (subtitle, trackNumber) {
console.log('Track ' + trackNumber + ':', subtitle)
})
parser.on('subtitle', (subtitle, trackNumber) =>
console.log('Track ' + trackNumber + ':', subtitle))
fs.createReadStream('Sintel.2010.720p.mkv').pipe(parser)

@@ -54,3 +55,3 @@ ```

> Note that the `language` may be `undefined` if the mkv track doesn't specify it.
> The `language` attribute can be `undefined` if the mkv track does not specify it.

@@ -67,13 +68,21 @@ ### `subtitle` event response format

> May also contain additional `.ass` specific values
## random access
The parser must obtain the `tracks` metadata event before it can begin to emit subtitles.
To read subtitles from a specific position in the stream,
you can pass in a previous instance as parameter: `parser = new MatroskaSubtitles(parser)`
after the `tracks` event and pipe from a given position. See [examples/random-access.js](https://github.com/mathiasvr/matroska-subtitles/blob/master/examples/random-access.js) for an example.
This module also includes a `SubtitleStream` class for intercepting subtitles
in mkv streams with support for seeking.
```js
const { SubtitleStream } = require('matroska-subtitles')
let subtitleStream = new SubtitleStream()
subtitleStream.once('tracks', (tracks) => {
// seek to different stream offset
})
```
See [examples/random-access.js](examples/random-access.js) for a detailed example.
## see also
[mkv-subtitle-extractor](https://www.npmjs.com/package/mkv-subtitle-extractor)
[mkv-subtitle-extractor](https://npm.im/mkv-subtitle-extractor)

@@ -80,0 +89,0 @@ ## license

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc