Player icon indicating copy to clipboard operation
Player copied to clipboard

Add libass support!

Open vegedb opened this issue 3 years ago • 28 comments

https://github.com/libass/libass image

As you can see, its weird not to see Just Player in here seeing its open sourced like the others. ASS/SSA subs is the only thing missing for Just player. Particularly for Anime fans!

Hope you could add it too!

vegedb avatar Dec 20 '22 06:12 vegedb

This is a job for ExoPlayer: https://github.com/google/ExoPlayer/issues/8435#issuecomment-759327563

moneytoo avatar Dec 20 '22 21:12 moneytoo

@moneytoo Its an entirely separate entity from exoplayer. Emby and plex (recently added libass) android players both use exoplayer and libass on top of it.

Hope you can look it up.

vegedb avatar Dec 20 '22 23:12 vegedb

https://libass.github.io/JavascriptSubtitlesOctopus/videojs.html https://libass.github.io/JavascriptSubtitlesOctopus/index.html

Here are some JS examples on browser players using libass.

vegedb avatar Dec 21 '22 00:12 vegedb

Configuring subtitle renderer possible in Just player?

Libass is an open source subtitle renderer and a replacement for the VSfilter.

Example,

  1. on MPC-HC, you could change it by pointing to a folder with libass.
  2. on MPV, you could point a "script" folder with latest libass

vegedb avatar Dec 21 '22 00:12 vegedb

If there were any publicly available patches/integration of libass in ExoPlayer, I would include them. Unfortunately, no one is sharing that. It would be needed to be implemented in the engine so it's really not a task for Just Player.

moneytoo avatar Jan 04 '23 23:01 moneytoo

As there is already the peerless2012/libass-android library, here's a test build of Just Player with it: https://brouken.com/player/libass/ It's not compatible with latest Media3 alphas and it causes some issues with non-ASS videos but feel free to try it.

moneytoo avatar Feb 18 '25 21:02 moneytoo

As there is already the peerless2012/libass-android library, here's a test build of Just Player with it: https://brouken.com/player/libass/ It's not compatible with latest Media3 alphas and it causes some issues with non-ASS videos but feel free to try it.

Already fixed, and external ass subtitle supported, check release.

Hope this can help you, if you have any issue, create an issue, pr is also great.

peerless2012 avatar Mar 28 '25 03:03 peerless2012

@moneytoo I tried the libasss-v0.191 branch and the results so far are not satisfactory. Compared to the vanilla player I noticed the following differences:

  1. The font is "thin", I have bold fonts enabled in the settings.
  2. The embedded font is not used, rather some generic fallback is being used, it's not as nice as the vanilla font, the edges are very jagged.
  3. Since the embedded font is not used, the fallback is too large and falls out of alignment (it starts to overlap with hardcoded subtitles).
  4. Not quite sure what happened but subtitles stopped working entirely after I accidentally closed the player and reopened it quickly within 5 seconds, changing the subtitles and turning them on or off had no effect. I had to completely close out of it again and then restart the video to make the subtitles work.

TheDcoder avatar Apr 21 '25 09:04 TheDcoder

Noticed another major bug, HDR/Dolby Vision has stopped working in this build, the TV is not getting the HDR metadata. It used to work perfectly fine in the previous stable release.

TheDcoder avatar Apr 21 '25 09:04 TheDcoder

@moneytoo I tried the libasss-v0.191 branch and the results so far are not satisfactory. Compared to the vanilla player I noticed the following differences:

  1. The font is "thin", I have bold fonts enabled in the settings.
  2. The embedded font is not used, rather some generic fallback is being used, it's not as nice as the vanilla font, the edges are very jagged.
  3. Since the embedded font is not used, the fallback is too large and falls out of alignment (it starts to overlap with hardcoded subtitles).
  4. Not quite sure what happened but subtitles stopped working entirely after I accidentally closed the player and reopened it quickly within 5 seconds, changing the subtitles and turning them on or off had no effect. I had to completely close out of it again and then restart the video to make the subtitles work.
  1. The font is "thin", I have bold fonts enabled in the settings.

Customer font style is not support now.

  1. The embedded font is not used, rather some generic fallback is being used, it's not as nice as the vanilla font, the edges are very jagged.

The embedded font in mkv should work, what's format of your file?

  1. Since the embedded font is not used, the fallback is too large and falls out of alignment (it starts to overlap with hardcoded subtitles).

Share the file, and I can make a test.

  1. Not quite sure what happened but subtitles stopped working entirely after I accidentally closed the player and reopened it quickly within 5 seconds, changing the subtitles and turning them on or off had no effect. I had to completely close out of it again and then restart the video to make the subtitles work.

And tell me how to reproduce this issue.

peerless2012 avatar Apr 25 '25 11:04 peerless2012

Noticed another major bug, HDR/Dolby Vision has stopped working in this build, the TV is not getting the HDR metadata. It used to work perfectly fine in the previous stable release.

My test dv mkv works fine on my pad, is this only for some file or all file?

peerless2012 avatar Apr 25 '25 11:04 peerless2012

@peerless2012 Thank you for the response!

Share the file, and I can make a test.

Sure! I extracted a segment from the file: https://send.cyberjake.xyz/download/fd7d2a6a671c8399/#An1H_OGoger95AMuPGfHDw

And tell me how to reproduce this issue.

Sorry, that's the best I could do, it's not easy to reproduce.

My test dv mkv works fine on my pad, is this only for some file or all file?

Not sure because I only tested with a single DV/HDR file, here's a segment from that file: https://send.cyberjake.xyz/download/ec8cd8cd45828e9b/#y4gjveDBP5XAt77icKylUQ

Just in case everything works for you, can you try my specific build of Just Player? This is the exact build that I used for testing: https://github.com/TheDcoder/JustPlayer/releases/tag/v0.191-libass

TheDcoder avatar Apr 25 '25 19:04 TheDcoder

Due to my test, the font in mkv works fine, both my demo and your's is workd.

Image

DV/HDR mkv, I can't confirm that's right or wrong.

And the subtitle lost or time error seems is a problem.

peerless2012 avatar Apr 25 '25 23:04 peerless2012

The subtitle lost issue is caused by the start time when setMedia

See this

peerless2012 avatar Apr 26 '25 02:04 peerless2012

Due to my test, the font in mkv works fine, both my demo and your's is workd.

That's nice... but then it makes me wonder why it doesn't work on my TV 😞

DV/HDR mkv, I can't confirm that's right or wrong.

The colours will look "washed out" (too bright etc.) if the HDR metadata is not sent, so if you didn't notice anything like that then it's probably working fine.

The subtitle lost issue is caused by the start time when setMedia

Great, you have already pin-pointed the issue! I'm not an Android developer so @moneytoo will have to fix this :)

TheDcoder avatar Apr 26 '25 11:04 TheDcoder

@peerless2012 I just tried the same media file in the Android Emulator (TV model) and the subtitles there are working fine, so it looks like the issue is limited to only some devices like my real TV 😕

Aside from that I also managed to reproduce the "no subtitles" issue reliably on the emulator, you just need to disable embedded subtitles and enable bold style from the settings, both options are important, otherwise the bug wouldn't be triggered.

After that point the subtitles will stop showing up entirely no matter what you do, even changing the settings back won't work. The only "fix" I have found is to wipe the app data. Not sure if this is the same bug as what I found on my real TV.

TheDcoder avatar Apr 27 '25 02:04 TheDcoder

I think all these issue is by the setMedia with position, you can delete postion filed in it and test again.

setMedia

Before:

player.setMediaItem(mediaItemBuilder.build(), mPrefs.getPosition());

After:

player.setMediaItem(mediaItemBuilder.build());

peerless2012 avatar Apr 27 '25 02:04 peerless2012

@peerless2012 Wow, that was a very fast response! I'll definitely try that but in the meanwhile I figured out why the subtitle formatting was "fixed", it's because I remuxed the file to cut out the audio and rest of the video.

I reinstalled the libass fork on my real TV and the test subtitle file worked absolutely fine. So the issue only happens with some files, and here's one of them with zero modifications: https://de.skysend.ch/download/d77da768a1e5f264/#4_ajV1ijQ0zB_irDz-kp_w

Please test this file, I am positive that it will be formatted improperly.

TheDcoder avatar Apr 27 '25 02:04 TheDcoder

To be sure, what I talk above (remove position in setMedia) is just a test way, if you remove it, you will lost the last position remember.

And if you want to use last position remember, you need to find another way, like on media prepared and seek. OR use LEGACY mode( No damic anim).

peerless2012 avatar Apr 27 '25 03:04 peerless2012

@peerless2012 I think the test fix worked, now I can't reproduce the issue.

Anyway, HDR/DV is the other big issue with the libass builds, I just reconfirmed the issue with several different video files and all of them are not sending the metadata. This is really visible in DV-only videos where the colours look all messed up (most of them become a shade of purple).

Any ideas why this might be happening?

TheDcoder avatar Apr 27 '25 03:04 TheDcoder

@peerless2012 Wow, that was a very fast response! I'll definitely try that but in the meanwhile I figured out why the subtitle formatting was "fixed", it's because I remuxed the file to cut out the audio and rest of the video.

I reinstalled the libass fork on my real TV and the test subtitle file worked absolutely fine. So the issue only happens with some files, and here's one of them with zero modifications: https://de.skysend.ch/download/d77da768a1e5f264/#4_ajV1ijQ0zB_irDz-kp_w

Please test this file, I am positive that it will be formatted improperly.

The file above can't play by media3, so I can't have a test.

And the dv mkv on my pad works fine, the dv logo on system bar is active when play.

peerless2012 avatar Apr 27 '25 14:04 peerless2012

@peerless2012 I am able to play the same file on my TV without any errors, can you try disabling thr video tunneling option in the settings? Some videos don't play with that enabled.

Regarding DV, are you using the OpenGL renderer? As you know during our testing today my TV displayed DV only with the legacy renderer.

TheDcoder avatar Apr 27 '25 17:04 TheDcoder

@peerless2012 I am able to play the same file on my TV without any errors, can you try disabling thr video tunneling option in the settings? Some videos don't play with that enabled.

Regarding DV, are you using the OpenGL renderer? As you know during our testing today my TV displayed DV only with the legacy renderer.

Try the latest bull in your fork, it's a CANVAS mode.

And I also test the OPEN_GL mode and CANVAS mode for dv you give me on my pad, the color is correct.

The mxplayer play dv, screen is green and purple, so I can confirm JustPlayer with ass plugin render the correct color.

peerless2012 avatar Apr 27 '25 20:04 peerless2012

@peerless2012 Unfortunately CANVAS mode has broken DV in my TV, I am back to seeing the incorrect green and purple colours.

As for the subtitles issue it's still present in the full video sample I sent to you. Were you able to get it to play on your device?

TheDcoder avatar Apr 28 '25 03:04 TheDcoder

Yes, just like I talk above. and let's test and talk on discord please.

peerless2012 avatar Apr 28 '25 03:04 peerless2012

@peerless2012 I may have figured out why your device was not able to play the full media sample I provided earlier, it uses a 10-bit colour depth which is not widely supported by many hardware decoders.

Here's another sample media from the same batch and has the same subtitle font issues, but it uses 8-bit colour depth which is supported by all decoders: https://de.skysend.ch/download/f0819b447cf7341d/#rX6p6fVlFLUtJ-caTOo_8g

TheDcoder avatar Apr 29 '25 19:04 TheDcoder

Use new OVERLY mode, both support ass animation and HDR/DV, so this conversation should be end.

peerless2012 avatar Jun 27 '25 04:06 peerless2012

@moneytoo should this issue be closed now that https://github.com/peerless2012/libass-android is available?

Pentaphon avatar Sep 13 '25 17:09 Pentaphon