-
-
Notifications
You must be signed in to change notification settings - Fork 1.3k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add support for native PGS subtitle rendering without transcoding #5688
Conversation
Quality Gate passedIssues Measures |
I might need a little help over at libpgs-js on how to get the web-worker output ES compatible. |
@Arcus92 May I ask you why webpack over rollup or Vite? |
@ferferga To be honest ... I haven't worked on web projects in a long time and it is the only bundler I kinda know. I'll look into other tools over the weekend. |
I know the basics of rollup, but I know that Vite has this option, which I use in Vue. I'm not sure how good Vite is for libraries though, and that's why I suggested rollup (since Vite is based on it). Your library is rather simple in terms of building, so I believe it shouldn't be too problematic with either bundler, but you'll likely have much more luck with both instead of webpack. Don't hesitate in pinging me in Matrix if I can be of some help |
As suggested in the backend PR, there is now an opt-in setting to enable experimental Pgs rendering. I'm working on a few performance and load improvements. |
I just found this PR, thanks for putting in the effort for this! |
@Sab44 PGS subtitles are image-based. Changing their position will result in markers/labels being displayed in the wrong place. The same goes for SSA/ASS. |
Regarding Tizen and webOS: webOS 5 emulator:
|
@dmitrylyzo Thanks for testing this on webOS! I could add a fallback in |
JSO renders in the worker, preparing images to be put on the canvas in the main thread. So the main thread only copies the image buffer from the worker and overlays it onto the canvas. You probably can do the same: parse PGS in the worker and produce a set of images. |
I should be able to refactor the lib to support both render paths: Rendering in worker by default and rendering in main thread as a fallback. I also try to setup a webOS emulator to verify the changes. Sounds like a fun weekend project 😄 |
First, thanks for this PR, it will be really great to have native PGS sub support on Tizen without transcoding 🎉 |
Have you tried using Chrome 79 (or older)? AFAIK, Chrome 80+ doesn't work. |
@dmitrylyzo WebOS 5 is using Chromium 68. Workers should work since version 4. |
I mean, you need to use Chrome 79 (and older) for debugging webOS 5 because Google removed some API. |
Oh, now I got you. Thanks for the hint. The oldest working build I could find is 75 but debugging doesn't change. However, the web worker is working on Desktop. 68 won't boot up on my desktop. |
@Arcus92 I got it working on webOS 5. We need to polyfill
I'm debugging using Chrome 79. |
@dmitrylyzo Already fixed this in the |
I'm testing with libpgs-0.5.0, and I managed to load the worker even on webOS 1.2. FIY, you can get
|
@Arcus92 My test branch with your
|
This pull request has merge conflicts. Please resolve the conflicts so the PR can be successfully reviewed and merged. |
@dmitrylyzo Sorry I was busy for a few days. Thanks for your contribution. I'll have a look at your commits right now. |
I finally fixed the issues by adding a browser detection in Normally I wouldn't check feature support via the userAgent, but in this case some of these legacy browser (like WebOS 5.0) have a broken worker implementation. I may need to add exceptions for other platforms if future issues are reported. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
PR works on:
- webOS 1.2 (main thread)
- webOS 5 (main thread)
- Chrome 128 (worker)
- Firefox 130 (worker)
I think we can use worker even on webOS 1.2, but it can be implemented separately.
Removed extra line breaks and using `classList.toggle` instead of `add` and `remove` to simplify code. Co-authored-by: Bill Thornton <[email protected]>
…as` or `Worker` support like webOS 1.2 by updating `libpgs`.
Quality Gate passedIssues Measures |
Cloudflare Pages deployment
|
Changes
This PR allows the client to request and render native PGS subtitle streams without transcoding. PGS is a graphical subtitle format. The subtitles are rendered locally by the client on-top of the video element.
This adds a new dependency
libpgs-js
. I just created this library for the Jellyfin project. If desired, you can fork it into the @jellyfin domain.Tasks
Related Pull Request (backend): jellyfin/jellyfin#12056
Related Pull Request (vue): jellyfin/jellyfin-vue#2404