All Projects → mathiasvr → matroska-subtitles

mathiasvr / matroska-subtitles

Licence: MIT license
💬 Streaming parser for embedded .mkv subtitles.

Programming Languages

javascript
184084 projects - #8 most used programming language

Projects that are alternatives of or similar to matroska-subtitles

chromecast-api
📺 Chromecast Node.js module
Stars: ✭ 122 (+205%)
Mutual labels:  stream, subtitles
Subtitle.js
Stream-based library for parsing and manipulating subtitle files
Stars: ✭ 234 (+485%)
Mutual labels:  stream, subtitles
Live Torrent
Torrent Web Client
Stars: ✭ 546 (+1265%)
Mutual labels:  stream, subtitles
laav
Asynchronous Audio / Video Library for H264 / MJPEG / OPUS / AAC / MP2 encoding, transcoding, recording and streaming from live sources
Stars: ✭ 50 (+25%)
Mutual labels:  stream, matroska
Rapidbay
Self-hosted torrent video streaming service compatible with Chromecast and AppleTV deployable in the cloud
Stars: ✭ 163 (+307.5%)
Mutual labels:  stream, subtitles
Multistream
A stream that emits multiple other streams one after another (streams3)
Stars: ✭ 237 (+492.5%)
Mutual labels:  stream
BAT FFMPEG
Batch script files for FFMPEG (Microsoft Windows and DOS, OS/2 🦄)
Stars: ✭ 104 (+160%)
Mutual labels:  mkv
Adalight Fastled
Adalight with FastLED support
Stars: ✭ 232 (+480%)
Mutual labels:  stream
Paguro
Generic, Null-safe, Immutable Collections and Functional Transformations for the JVM
Stars: ✭ 231 (+477.5%)
Mutual labels:  stream
Commander
Arduino Command Line Utility
Stars: ✭ 20 (-50%)
Mutual labels:  stream
streamplify
Java 8 combinatorics-related streams and other utilities
Stars: ✭ 40 (+0%)
Mutual labels:  stream
guide.encode.moe
A guide for fansubbing
Stars: ✭ 123 (+207.5%)
Mutual labels:  subtitles
vtt-creator
Very basic Node.js/JavaScript library to generate VTT open subtitles files
Stars: ✭ 22 (-45%)
Mutual labels:  subtitles
Azure Event Hubs
☁️ Cloud-scale telemetry ingestion from any stream of data with Azure Event Hubs
Stars: ✭ 233 (+482.5%)
Mutual labels:  stream
mock-hls-server
Fake a live/event HLS stream from a VOD one. Useful for testing. Supports looping.
Stars: ✭ 61 (+52.5%)
Mutual labels:  stream
Tributary
Streaming reactive and dataflow graphs in Python
Stars: ✭ 231 (+477.5%)
Mutual labels:  stream
RenameThemSubs
Rename multiple subtitles files to match video file names for automatic loading with just one click
Stars: ✭ 40 (+0%)
Mutual labels:  subtitles
create-music-stream
Creates a PCM 16 bit Little Endian Stream from a mp3 file or youtube video
Stars: ✭ 21 (-47.5%)
Mutual labels:  stream
custom-subs
Anime Subs
Stars: ✭ 58 (+45%)
Mutual labels:  subtitles
SABRE.js
Substation Alpha suBtitles REnderer -- A Gpu Accelerated Javascript Advanced SubStation (ASS) Alpha Subtitles Renderer. Renders .ass and .ssa files.
Stars: ✭ 58 (+45%)
Mutual labels:  subtitles

matroska-subtitles

NPM Downloads Dependency status License forthebadge

Streaming parser for embedded .mkv subtitles.

Supported formats: .srt, .ssa, .ass.

install

$ npm install matroska-subtitles

or include it directly:

<script src="https://cdn.jsdelivr.net/npm/[email protected]/dist/matroska-subtitles.min.js"></script>

example

const fs = require('fs')
const { SubtitleParser } = require('matroska-subtitles')

const parser = new SubtitleParser()

// first an array of subtitle track information is emitted
parser.once('tracks', (tracks) => console.log(tracks))

// afterwards each subtitle is emitted
parser.on('subtitle', (subtitle, trackNumber) =>
  console.log('Track ' + trackNumber + ':', subtitle))

fs.createReadStream('Sintel.2010.720p.mkv').pipe(parser)

See examples folder for more examples.

tracks event response format

[
  { number: 3, language: 'eng', type: 'utf8', name: 'English(US)' },
  { number: 4, language: 'jpn', type: 'ass', header: '[Script Info]\r\n...' }
]
  • The language attribute can be undefined if the mkv track does not specify it, this is often interpreted as eng.
  • The name attribute is not standard but may provide language info.

subtitle event response format

{
  text: 'This blade has a dark past.',
  time: 107250,  // ms
  duration: 1970 // ms
}

attached files

The parser now also has a file event that emits embedded mkv files, mainly to be used to extract embedded subtitle fonts.

parser.on('file', file => console.log('file:', file))

Output:

{
  filename: 'Arial.ttf',
  mimetype: 'application/x-truetype-font',
  data: Buffer() [Uint8Array]
}

random access

This module also includes a SubtitleStream class for intercepting subtitles in mkv streams with support for seeking.

const { SubtitleStream } = require('matroska-subtitles')

let subtitleStream = new SubtitleStream()

subtitleStream.once('tracks', (tracks) => {
  // close the old subtitle stream and open a new at a different stream offset
  subtitleStream = new SubtitleStream(subtitleStream)
})

See examples/random-access.js for a detailed example.

see also

mkv-subtitle-extractor

license

MIT

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].