Yes, I know my topic is similar to… - that should mean something to you.
https://support.plex.tv/articles/204096476-license-information/
Web-Based Apps
Many of our apps share a common, web/HTML5-based core. These include the regular browser-based web app, Chromecast, and the Windows & Mac “desktop” apps, as well as the web-based authentication app.
- libjass – Apache 2.0
Well, why don’t they ever work in my browser (without transcoding) then?
This repository has been archived by the owner. It is now read-only.
I seriously considered just pasting the entire message from the author’s Github here…and then I realized I could use a details/summary tag. This is the most important part anyways:
You should probably use something else, like GitHub - libass/JavascriptSubtitlesOctopus: Displays subtitles in .ass format from JavaScript. Supports most SSA/ASS features, easily integrates with HTML5 videos.
This project is no longer being worked on.
You should probably use something else, like GitHub - libass/JavascriptSubtitlesOctopus: Displays subtitles in .ass format from JavaScript. Supports most SSA/ASS features, easily integrates with HTML5 videos.
When I started libjass in 2011, I made a bet that offloading rendering to the DOM would eventually be the way to get fast and accurate rendering. CSS filter effects were about to be standardized. Regular JavaScript would’ve been too slow to do the fancy rendering that ASS requires. Surely letting the browser render text would be faster than parsing fonts in JS, computing the dimensions and margins for every rendered character, and blitting individual outline and shadow pixels to a canvas.
However CSS filter effects by themselves turned out to be inadequate to accurately render even the basics of ASS. SVG filters are more accurate, but are unoptimized or unsupported in all browsers since nobody really uses them (a vicious cycle). As such, both of them are unable to efficiently render the simplest and most common ASS feature - the elliptical border. The feMorphology SVG filter can only dilate to rectangles, so libjass has to stack many such rectangles of different sizes to approximate an ellipse. Big borders end up needing tens of such rectangles and a large gaussian blur, which brings even the mightiest browser’s renderer to its single-threaded knees.
Layout also has problems. CSS doesn’t provide an easy to way for a subtitle to push another subtitle away so that they don’t overlap. It doesn’t provide a line-breaking strategy that tries to equalize the lengths of the broken lines (what ASS calls smart line wrapping). Vertically centering things is still a nightmare - flexbox and CSS grid don’t help because subtitles don’t follow grids - so \an4-6 were never properly implemented. These things could be solved by positioning the text manually, but this would’ve brought us back to the problem of parsing fonts and measuring text dimensions in JavaScript instead of letting the DOM handle it.
In 2013, asm.js became a way to use the original C renderers like libass, compiled to something that’s not as fast as native C but still faster than regular JavaScript rendering. More recently, WASM has emerged as a more cross-platform and strongly-guaranteed way of doing this. Parsing fonts and computing dimensions is now a feasible prospect.
Because of this, I believe libjass’s strategy of relying on the browser DOM is a dead end.
I’m happy to continue providing support and answering questions about the code on Github. Since this repository is archived, please ask by opening an issue at GitHub - Arnavion/archived-repos-issues: Issues for my archived repos instead. The code in this repository is still available under APL-2.0. The ASS parser is functional regardless of the browser renderer. Feel free to fork this project, or incorporate its code into your own projects, under the terms of the license.
Thank you, the users who used libjass on your websites, opened issues, and contributed fixes. libjass was my first OSS project that I intended to be used by more people than me. I had fun working on it and learning about web dev.
libjass has been dead since 2016. SSA is not an evolving standard for crying out loud.
Kotus (18 February 2002). “Sub Station Alpha v4.00+ Script Format”
That’s when the standard was last updated. 2002.
Features
- Supports most SSA/ASS features (everything libass supports)
- Supports all OpenType- and TrueType-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’ extensions (but beware of compatability to other ASS-renderers when using them)
- Easy to use - just connect it to video element
There were commits made a few days ago. All Plex Server would have to make sure to do after JavascriptSubtitlesOctopus is implemented would be to temporarily demux any/all attached fonts and serve URLs to them during playback.
That also explains why trying to force Plex Web to render them looks the way it does. It can parse .ass, but just barely, and with close to no font support. Fix it already.
Also, this is somewhat unrelated, but I know it will get attention so I’ll ask anyways. What happened to the links to the Plex Transcoder source code? I cannot find them on the download page. I want to try things.