All Projects → SABRE-JS → SABRE.js

SABRE-JS / SABRE.js

Licence: other
Substation Alpha suBtitles REnderer -- A Gpu Accelerated Javascript Advanced SubStation (ASS) Alpha Subtitles Renderer. Renders .ass and .ssa files.

Programming Languages

javascript
184084 projects - #8 most used programming language
shell
77523 projects
HTML
75241 projects

Projects that are alternatives of or similar to SABRE.js

nekocap
Browser extension for creating & uploading community captions for YouTube, niconico and other video sharing sites.
Stars: ✭ 27 (-53.45%)
Mutual labels:  subtitles, substation-alpha
Youtube Extension
🔴YouTube Extension🧰>80 Features ⭐Please document, code or donate📌Tidy📌Longest-standing(2012)(Users>350000)⋮🎞️🎛️🎧⚙️🎬🔊☕🎨🧩🧪📈⏯️(Player: Repeat Screenshot Rotate; Hide related video distraction. Always expand video Description. Playback speed. Video Quality bandwidth H.264 electricity. Player Size Full Window. Themes Customization. Statistics. Reverse Playlist YouTube YouTube YouTube YouTube YouTube YouTube YouTube YouTube YouTube YouTube YouTube YouTube YouTube YouTube YouTube YouTube YouTube YouTube YouTube YouTube YouTube YouTube YouTube YouTube YouTube YouTube YouTube YouTube YouTube YouTube YouTube YouTube YouTube YouTube YouTube YouTube YouTube YouTube YouTube YouTube YouTube YouTube YouTube YouTube YouTube YouTube YouTube YouTube YouTube YouTube YouTube YouTube YouTube YouTube YouTube YouTube YouTube YouTube YouTube YouTube YouTube YouTube YouTube YouTube YouTube YouTube YouTube YouTube YouTube YouTube YouTube YouTube YouTube YouTube YouTube YouTube YouTube YouTube YouTube YouTube YouTube YouTube YouTube YouTube YouTube YouTube YouTube YouTube YouTube YouTube YouTube YouTube YouTube YouTube YouTube YouTube YouTube YouTube YouTube YouTube YouTube YouTube Youtube enhancer YouTube app YouTube video YouTube YouTube YouTube api v3 YouTube playback YouTube player VP8 VP9 AV1 vidIQ tubebuddy download adblocker adblock ads sponsorblock addon youtube music ⭐ youtube premium css css4 html5 ytdl youtube-dl invidious iridium ParticleCore youtube+ youtube++ youtube-plus maia-yt youtube nonstop youtube control center vlogger vlog h264ify h264 m.youtube.com music.youtube.com studio.youtube youtube mobile youtube studio ⭐ kids Vanced gaming.youtube.com gaming youtubecenter freetube lite-youtube-embed newpipe youtube-dl-gui mps-youtube nuclear pytube awesome youtubers youtube downloader 8k 4k 60fps 30fps youtubeexplode vidgear k-lite tubebuddy adobe apple ios iphone design simplify ffmpeg premiere designer annoyance youtube upload
Stars: ✭ 1,027 (+1670.69%)
Mutual labels:  html5-video, subtitles
pysubs2
A Python library for editing subtitle files
Stars: ✭ 174 (+200%)
Mutual labels:  subtitles, substation-alpha
libgosubs
golang library to read and write various subtitle formats
Stars: ✭ 20 (-65.52%)
Mutual labels:  ass, subtitles
ST-ASS
ASS/SSA subtitles syntax highlight for Sublime Text.
Stars: ✭ 23 (-60.34%)
Mutual labels:  ssa, ass
Fluid Player
Fluid Player - an open source VAST compliant HTML5 video player
Stars: ✭ 359 (+518.97%)
Mutual labels:  html5-video, javascript-library
PyonFX
An easy way to create KFX (Karaoke Effects) and complex typesetting using the ASS format (Advanced Substation Alpha).
Stars: ✭ 101 (+74.14%)
Mutual labels:  ass, advanced-substation-alpha
vtt-creator
Very basic Node.js/JavaScript library to generate VTT open subtitles files
Stars: ✭ 22 (-62.07%)
Mutual labels:  javascript-library, subtitles
ass-compiler
Parses and compiles ASS subtitle format to easy-to-use data structure
Stars: ✭ 73 (+25.86%)
Mutual labels:  ssa, ass
pysub-parser
Library for extracting text and timestamps from multiple subtitle files (.ass, .ssa, .srt, .sub, .txt).
Stars: ✭ 40 (-31.03%)
Mutual labels:  ssa, subtitles
Javascriptsubtitlesoctopus
Displays subtitles in .ass format via JavaScript. Supports all SSA/ASS features, easily integrates with HTML5 videos.
Stars: ✭ 199 (+243.1%)
Mutual labels:  html5-video, subtitles
Larkplayer
🚀 A lightweight & flexible web player :)
Stars: ✭ 82 (+41.38%)
Mutual labels:  html5-video
Lightgallery.js
Full featured JavaScript image & video gallery. No dependencies
Stars: ✭ 5,168 (+8810.34%)
Mutual labels:  html5-video
React Html5video
A customizeable HTML5 Video React component with i18n and a11y.
Stars: ✭ 448 (+672.41%)
Mutual labels:  html5-video
Lightgallery
A customizable, modular, responsive, lightbox gallery plugin.
Stars: ✭ 4,829 (+8225.86%)
Mutual labels:  html5-video
Griffith
A React-based web video player
Stars: ✭ 2,287 (+3843.1%)
Mutual labels:  html5-video
Indigo Player
Highly extensible, modern, JavaScript video player. Handles MPEG-Dash / HLS / MPEG-4 and is built on top of the HTML5 video element.
Stars: ✭ 1,173 (+1922.41%)
Mutual labels:  html5-video
Seethru
HTML5 video with alpha channel transparencies
Stars: ✭ 416 (+617.24%)
Mutual labels:  html5-video
Xgplayer
A HTML5 video player with a parser that saves traffic
Stars: ✭ 4,792 (+8162.07%)
Mutual labels:  html5-video
Userscripts
基于Chrome下的Tampermonkey写的一些个人用户脚本
Stars: ✭ 137 (+136.21%)
Mutual labels:  html5-video

SABRE.js

SABRE.js: Substation Alpha suBtitles REnderer

A Gpu Accelerated Javascript Advanced Substation Alpha Subtitles Renderer.

code style: prettier CodeFactor Featured on Openbase

What is SABRE.js?

SABRE.js is a full renderer for Substation Alpha Subtitles and Advanced Substation Alpha Subtitles. It allows you to draw styled/stylized subtitles over web video with multiple fonts, colors, animations and effects.

Other Similar software.

  • Javascript-Subtitles-Octopus
  • Libass
  • XY-VSFilter

Gallery

A gallery of major milestones in the development process.

To view the gallery click here if you're using a decent browser or here if you like safari or internet explorer.

Folder Structure

  • src/ -- Main sourcecode for the project (excluding src/__tests__)
  • src/__tests__/ -- Test code for test driven development.
  • include/ -- Browser API definitions and internal API definitions for the Closure Compiler (Files in this folder aren't compiled).
  • bin/ -- Output directory for production code.
  • debugbin/ -- Output directory for debug code.
  • scripts/ -- Contains scripts that are run by the makefile.
  • tbin/ -- Contains the Closure Compiler and other build tools.
  • temp_files/ -- Temporary files.
  • test/ -- Directory used when running the debug server.

Documentation

How to include the library (from the jsdelivr CDN, this cdn is recommended as they publish usage statistics for each package):

<script src="https://cdn.jsdelivr.net/npm/opentype.js@latest/dist/opentype.min.js"></script>
<script src="https://cdn.jsdelivr.net/npm/@sabre-js/sabre@latest/dist/sabre.min.js"></script>

How to include the library (from the unpkg CDN, for the more privacy minded):

<script src="https://unpkg.com/opentype.js@latest/dist/opentype.min.js"></script>
<script src="https://unpkg.com/@sabre-js/sabre@latest/dist/sabre.min.js"></script>

You can retrieve an instance of the library by calling sabre.SABRERenderer like so from a load event handler:

let renderer;
window.addEventListener("load",() => {
    let subs = "";
    let fonts = [];
    // load the contents of the subtitle file into subs.
    // YOUR CODE HERE
    // load the fonts using opentype.js and put them in
    // the fonts array.
    // YOUR CODE HERE
    // pass the font parsing function to the renderer
    renderer = sabre.SABRERenderer(parseFont);
    renderer.loadSubtitles(subs,fonts);
    renderer.setViewport(1280,720); // use the video player's dimensions.
    // schedule your frame callback using either requestAnimationFrame or requestVideoFrameCallback
});

and passing it a function that loads fonts using opentype.js as shown below:

function parseFont(data) {
    return opentype.parse(data);
}

You may then call loadSubtitles passing in a string containing the contents of the subtitle file and set the viewport with setViewport as shown in the example above. Anytime the video or player is resized you should call setViewport with the new dimensions of the player.

Each frame, before you call any of the rendering functions, first call checkReadyToRender to see if the library is ready to render a frame of subtitles.

API

Functions

loadSubtitles(subsText, fonts)void

Begins the process of parsing the passed subtitles in SSA/ASS format into subtitle events.

setViewport(width, height)void

Updates the resolution at which the subtitles are rendered (if the player is resized, for example).

checkReadyToRender()boolean

Checks if the renderer is ready to render a frame.

getFrame(time)ImageBitmap

Fetches a rendered frame of subtitles as an ImageBitmap, returns null if ImageBitmap is unsupported.

getFrameAsUri(time, callback)void

Fetches a rendered frame of subtitles as an object uri.

drawFrame(time, canvas, [contextType])void

Fetches a rendered frame of subtitles to a canvas.

loadSubtitles(subsText, fonts) ⇒ void

Begins the process of parsing the passed subtitles in SSA/ASS format into subtitle events.

Kind: global function

Param Type Description
subsText string the subtitle file's contents.
fonts Array.<Font> preloaded fonts nessisary for this subtitle file (one of these MUST be Arial).

setViewport(width, height) ⇒ void

Updates the resolution at which the subtitles are rendered (if the player is resized, for example).

Kind: global function

Param Type Description
width number the desired width of the resolution.
height number the desired height of the resolution.

checkReadyToRender() ⇒ boolean

Checks if the renderer is ready to render a frame.

Kind: global function
Returns: boolean - is the renderer ready?

getFrame(time) ⇒ ImageBitmap

Fetches a rendered frame of subtitles as an ImageBitmap, returns null if ImageBitmap is unsupported.

Kind: global function

Param Type Description
time number the time at which to draw subtitles.

getFrameAsUri(time, callback) ⇒ void

Fetches a rendered frame of subtitles as an object uri.

Kind: global function

Param Type Description
time number the time at which to draw subtitles.
callback function a callback that provides the URI for the image generated.

drawFrame(time, canvas, [contextType]) ⇒ void

Fetches a rendered frame of subtitles to a canvas.

Kind: global function

Param Type Description
time number the time at which to draw subtitles.
canvas HTMLCanvasElement | OffscreenCanvas the target canvas
[contextType] string the context type to use (must be one of "bitmap" or "2d"), defaults to "bitmap" unless unsupported by the browser, in which case "2d" is the default.

© 2012-2022 Patrick "ILOVEPIE" Rhodes Martin.

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