All Projects → Dador → Javascriptsubtitlesoctopus

Dador / Javascriptsubtitlesoctopus

Licence: mit
Displays subtitles in .ass format via JavaScript. Supports all SSA/ASS features, easily integrates with HTML5 videos.

Programming Languages

python
139335 projects - #7 most used programming language

Projects that are alternatives of or similar to Javascriptsubtitlesoctopus

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 (+416.08%)
Mutual labels:  subtitles, html5-video
SABRE.js
Substation Alpha suBtitles REnderer -- A Gpu Accelerated Javascript Advanced SubStation (ASS) Alpha Subtitles Renderer. Renders .ass and .ssa files.
Stars: ✭ 58 (-70.85%)
Mutual labels:  html5-video, subtitles
Parsing With Haskell Parser Combinators
🔍 A step-by-step guide to parsing using Haskell parser combinators.
Stars: ✭ 72 (-63.82%)
Mutual labels:  subtitles
Rapidbay
Self-hosted torrent video streaming service compatible with Chromecast and AppleTV deployable in the cloud
Stars: ✭ 163 (-18.09%)
Mutual labels:  subtitles
Intersubs
Interactive subtitles for mpv. Instantly translate selected word/sentence.
Stars: ✭ 111 (-44.22%)
Mutual labels:  subtitles
Larkplayer
🚀 A lightweight & flexible web player :)
Stars: ✭ 82 (-58.79%)
Mutual labels:  html5-video
React Jplayer
Html5 audio and video player library for React
Stars: ✭ 128 (-35.68%)
Mutual labels:  html5-video
Sub Tv Cli
Downloading your series subtitles via terminal 📺
Stars: ✭ 63 (-68.34%)
Mutual labels:  subtitles
Subaligner
Automatically synchronize subtitles to audiovisual content with a pretrained deep neural network and forced alignments. https://subaligner.readthedocs.io/
Stars: ✭ 181 (-9.05%)
Mutual labels:  subtitles
Aegisub Motion
Lua plugin for Aegisub auto4 that parses motion tracking data and applies it to selected subtitles.
Stars: ✭ 109 (-45.23%)
Mutual labels:  subtitles
Gaupol
Editor for text-based subtitle files
Stars: ✭ 159 (-20.1%)
Mutual labels:  subtitles
Submerger
SRT Subtitles Merger
Stars: ✭ 92 (-53.77%)
Mutual labels:  subtitles
Subsync
Synchronize your subtitles using machine learning
Stars: ✭ 84 (-57.79%)
Mutual labels:  subtitles
Html5 Dash Hls Rtmp
🌻 HTML5播放器、M3U8直播/点播、RTMP直播、低延迟、推流/播流地址鉴权
Stars: ✭ 1,805 (+807.04%)
Mutual labels:  html5-video
Subed
Subtitle editor for Emacs
Stars: ✭ 77 (-61.31%)
Mutual labels:  subtitles
Autosubsync
Automatically synchronize subtitles with audio using machine learning
Stars: ✭ 179 (-10.05%)
Mutual labels:  subtitles
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 (+489.45%)
Mutual labels:  html5-video
Pasta
Audio & Subtitle Track Changer for Plex
Stars: ✭ 90 (-54.77%)
Mutual labels:  subtitles
Qladdict
A QuickLook plugin that lets you view subtitles .srt files like Addic7ed.com on mac
Stars: ✭ 114 (-42.71%)
Mutual labels:  subtitles
Griffith
A React-based web video player
Stars: ✭ 2,287 (+1049.25%)
Mutual labels:  html5-video

Actions Status

SubtitlesOctopus displays subtitles in .ass format and easily integrates with HTML5 videos. It supports all SSA/ASS features and fully compatible with libass.

ONLINE DEMO / other examples with demo

Features

  • Supports all SSA/ASS features
  • Supports any fonts (including woff2 fonts)
  • Works fast (because uses WebAssembly with fallback to asm.js if it's not available)
  • Uses Web Workers thus video and interface doesn't lag even on "heavy" subtitles (working in background)
  • Doesn't use DOM manipulations and render subtitles on single canvas
  • Fully compatible with libass
  • Easy to use - just connect it to video element

Included Libraries

  • expat
  • fontconfig
  • freetype
  • fribidi
  • harfbuzz

Usage

To start using SubtitlesOctopus you only need to instantiate a new instance of SubtitlesOctopus and specify its Options.

var options = {
    video: document.getElementById('video'), // HTML5 video element
    subUrl: '/test/test.ass', // Link to subtitles
    fonts: ['/test/font-1.ttf', '/test/font-2.ttf'], // Links to fonts (not required, default font already included in build)
    workerUrl: '/libassjs-worker.js', // Link to WebAssembly-based file "libassjs-worker.js"
    legacyWorkerUrl: '/libassjs-worker-legacy.js' // Link to non-WebAssembly worker
};
var instance = new SubtitlesOctopus(options);

After that SubtitlesOctopus automatically "connects" to your video and it starts to display subtitles. You can use it with any HTML5 player.

See other examples.

Using only with canvas

You're also able to use it without any video. However, that requires you to set the time the subtitles should render at yourself:

var options = {
    canvas: document.getElementById('canvas'), // canvas element
    subUrl: '/test/test.ass', // Link to subtitles
    fonts: ['/test/font-1.ttf', '/test/font-2.ttf'], // Links to fonts (not required, default font already included in build)
    workerUrl: '/libassjs-worker.js' // Link to file "libassjs-worker.js"
};
var instance = new SubtitlesOctopus(options);
// And then...
instance.setCurrentTime(15); // Render subtitles at 00:15 on your canvas

Changing subtitles

You're not limited to only display the subtitle file you referenced in your options. You're able to dynamically change subtitles on the fly. There's three methods that you can use for this specifically:

  • setTrackByUrl(url): works the same as the subUrl option. It will set the subtitle to display by its URL.
  • setTrack(content): works the same as the subContent option. It will set the subtitle to dispaly by its content.
  • freeTrack(): this simply removes the subtitles. You can use the two methods above to set a new subtitle file to be displayed.
var instance = new SubtitlesOctopus(options);

// ... we want to change the subtitles to the Railgun OP
instance.setTrackByUrl('/test/railgun_op.ass');

Cleaning up the object

After you're finished with rendering the subtitles. You need to call the instance.dispose() method to correctly dispose of the object.

var instance = new SubtitlesOctopus(options);

// After you've finished using it...

instance.dispose();

Options

When creating an instance of SubtitleOctopus, you can set the following options:

  • video: The video element to attach listeners to. (Optional)
  • canvas: The canvas to render the subtitles to. If none is given it will create a new canvas and insert it as a sibling of the video element (only if the video element exists). (Optional)
  • subUrl: The URL of the subtitle file to play. (Require either subUrl or subContent to be specified)
  • subContent: The content of the subtitle file to play. (Require either subContent or subUrl to be specified)
  • workerUrl: The URL of the worker. (Default: libassjs-worker.js)
  • fonts: An array of links to the fonts used in the subtitle. (Optional)
  • availableFonts: Object with all available fonts - Key is font name in lower case, value is link: {"arial": "/font1.ttf"} (Optional)
  • timeOffset: The amount of time the subtitles should be offset from the video. (Default: 0)
  • onReady: Function that's called when SubtitlesOctopus is ready. (Optional)
  • onError: Function called in case of critical error meaning the subtitles wouldn't be shown and you should use an alternative method (for instance it occurs if browser doesn't support web workers). (Optional)
  • debug: Whether performance info is printed in the console. (Default: false)

Fast Render Mode (Lossy) (EXPERIMENTAL)

The Fast Render mode has been created by @no1d as a suggestion for fix browser freezing when rendering heavy subtitles (#46), it use createImageBitmap to render the bitmap in the Worker, using Promises instead of direct render on canvas in the Main Thread. When the browser start to hang, it will not lock main thread, instead will run Async, so if the function createImageBitmap fail, it will not stop the rendering process at all and may cause some bitmap loss or simply will not draw anything in canvas, mostly on low end devices.

WARNING: Experimental, not stable and not working in Safari

To enable this mode set the option lossyRender to true when creating an instance of SubtitleOctopus.

Brotli Compressed Subtitles

The SubtitleOctopus allow the use of compressed subtitles in brotli format, saving bandwidth and reducing library startup time

To use, just run: brotli subFile.ass and use the .br result file with the subUrl option

How to build?

Dependencies

  • git
  • emscripten (Configure the enviroment)
  • llvm
  • clang
  • ragel
  • make
  • autoconf
  • python3
  • pkgconfig
  • patch
  • libtool
  • itstool
  • automake
  • python-lxml
  • python-pip
  • python-html5lib
  • python-chardet
  • gperf

Get the Source

Run git clone --recursive https://github.com/Dador/JavascriptSubtitlesOctopus.git

Build with Docker

  1. Install Docker
  2. docker build -t dador/javascriptsubtitlesoctopus .
  3. docker run -it --rm -v ${PWD}:/code dador/javascriptsubtitlesoctopus:latest
  4. Artifacts are in /dist/js

Why "Octopus"?

How am I an Octopus? Ba da ba da ba!

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