-
Notifications
You must be signed in to change notification settings - Fork 529
Add libass native decoder #2324
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
base: main
Are you sure you want to change the base?
Conversation
The fonts are sent to the renderer via the format metadata.
This news native decoder use libass to parse and render the ssa/ass subtitle. Co-authored-by: Vincent Zauhar <v.zauhar@bell.net> Co-authored-by: SonnyUplavan <sonny-issara.uplavan.1@ens.etsmtl.ca> Co-authored-by: Raphael Dupuis <78157341+Raphael863@users.noreply.github.com>
The "VSFilter mangled colors" is requested by libass. See: https://github.com/libass/libass/blob/5b44c4d690254a7bd8de2e048fa23820036b671b/libass/ass_types.h#L157-L262 The math formula are from: https://en.wikipedia.org/wiki/YCbCr#R'G'B'_to_Y%E2%80%B2PbPr Co-authored-by: Vincent Zauhar <v.zauhar@bell.net>
Thanks for your pull request! It looks like this may be your first contribution to a Google open source project. Before we can look at your pull request, you'll need to sign a Contributor License Agreement (CLA). View this failed invocation of the CLA check for more information. For the most up to date status, view the checks section at the bottom of the pull request. |
I'm afraid we are unlikely to merge this PR as the maintenance burden is likely to be too high for the benefit it brings, as I previously mentioned in this comment: google/ExoPlayer#8435 (comment) |
well imho its for millions of ppl watching anime.. no one from exo community was able to do anything to support ass/ssa subs for more then 8 years, so I think benefits are too high for you to let this pass, when there is finally someone who is able to do it and spend his time to make it work... @moi15moi thanks for your hard work and dont let him discourage you. |
This PR adds a new decoder for
.ass
subtitles to fix this issue: google/ExoPlayer#8435It also partially fixes the following issue: #691
It is currently a draft because the following issues still need to be addressed:
.ass
subtitles muxed in MKV files. It would also needs to support "raw" .ass file.AssRenderer
is added inSubtitleTranscodingTrackOutput.java
andDefaultRenderersFactory.java
is hacky.draw_ass_rgba
is too slow for 4K (3840x2160) bitmaps where the subtitle completely covers the screen. Neon optimization is needed (or maybe openmp?).Note: We are no longer working on this PR. If anyone wants to use it as a base, feel free to improve it and open a non-draft PR.
Why should Media3 provide a native decoder using libass?
It’s practically impossible to replicate libass behavior accurately.
The first commit that introduced SSA/ASS subtitle support in Media3 is this one, made in 2017 — that was 8 years ago, and Media3 still lacks support for many elements of the ASS/SSA spec.
Here's a screenshot showing the video with and without subtitles. Implementing this in SsaParser.java is far from trivial.


Also, here’s a video that contains a
.ass
subtitle (hardsubbed). The subtitle is the text: "CIBLE DE LA QUÊTE".https://github.com/user-attachments/assets/af2b54b5-baf8-41d9-bc05-f97702757402
Again, implementing all the feature in java needed just to display the subtitle accuratly is basically impossible.
Finally, note that this PR is the work of Raphael Dupuis, Sonny Uplavan, Vincent Zauhar and me.