Repository navigation
Conversation
MattiaSt1
marked this pull request as draft
October 20, 2026 19:33
Render ASS/SSA subtitles with libass 0.17.5 in an overlay on top of the video, like mpv and VLC do, instead of converting them to plain cues. Works with external .ass/.ssa files and with ASS tracks embedded in MKV, including attached fonts. It can be turned off in the player settings. libass is built from source together with FreeType 2.15.0, FriBidi 1.0.17 and HarfBuzz 14.6.0: - The official release tarballs are downloaded at configure time and checked against pinned SHA-256 hashes, nothing prebuilt is used. The libass and FreeType hashes come from tarballs with a verified PGP signature. - Everything is linked statically into libcs3ass.so, with the static C++ runtime so it can not clash with the other native libraries.
MattiaSt1
force-pushed
the
libass-subtitles
branch
from
October 20, 2026 20:33
26ed803 to
d3e3081
Compare
MattiaSt1
marked this pull request as ready for review
October 20, 2026 20:44
Collaborator
|
Nice! I am planning on making this a dependency within the recloudstream organization, with your code as the basis. Is that okay? I want to remove the C++ build process entirely within CloudStream. Your pull request will still remain, the build will just be substituted with an |
Author
|
Feel free to do whatever you think is best. |
This branch has not been deployed
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
What
Adds full ASS/SSA subtitle rendering through libass 0.17.5, built from source.
How
LibassSubtitleSupportbridges ExoPlayer and libass. It gets the playbackposition from a NoSampleRenderer, renders on a dedicated thread and draws the
result in a transparent overlay view inside
exo_content_frame, so it followsresize modes and pinch zoom.
CustomDecoderloads thewhole file into libass and stops forwarding text cues. SsaParser still runs,
so subtitle sync keeps working.
UpdatedMatroskaExtractorsends each dialogue and the attached fonts tolibass; the wrapped subtitle parser factory returns a no-op parser for those
tracks.
subtitle pipeline is used.
Native build
app/src/main/cpp/libass-deps.cmakedownloads the official release tarballs of libass 0.17.5,FreeType 2.15.0, FriBidi 1.0.17 and HarfBuzz 14.6.0. Each tarball is checked against a pinned
SHA-256 and the build fails on any mismatch. Nothing prebuilt is downloaded. The libass and
FreeType hashes come from tarballs with a verified PGP signature (FriBidi and HarfBuzz do not
sign their releases).
app/build/libass-depsand shared between ABIsand variants. No CI changes are needed, Gradle installs the NDK if missing.
CMakeLists.txtbuilds everything as static libraries: FreeType without externaldependencies, FriBidi with its config headers written by CMake (it only has a meson build),
HarfBuzz as a single file without optional integrations, and libass with its ARM64 assembly
on arm64 (the x86 assembly needs NASM, so the C version is used there).
libcs3ass.sotogether with the static C++ runtime, so it can notclash with the other native libraries. It only exports the JNI functions, only depends on
system libraries and is 16 KB page aligned. About 1.5–2.2 MB per ABI.
libass-deps.cmake.Testing
Attached
libass_effects_test.ass: 16 scenes covering positioning, colors,fades, movement, 3D rotations, karaoke, clips, vector drawings, transparency
and non-Latin scripts. Load it on any video.
Tested on: Pixel 11 Pro XL
AI USED (Claude opus 5.5)
libass_effects_test.ass.txt