v19 [v19.1] Kodi loads all fonts instead of required ones on a video with ass subtitle
#1
Hi all,

I notice for Kodi v19.1, it will loads ALL fonts in media/Fonts when starting a video with ass subtitle, including ones that are not used by this video.  It becomes an issue when the total size of fonts is getting big.  This usually happens on Chinese character fonts, which usually have size from 5MB all the way to 10MB, some over 30MB.  Even worse, each video might use different fonts and the total size of the font collection grows easily over hundred of MB.

Interestingly, I didn't see this behavior on Kodi v19.0 (LibreElec v10b2) or earlier.  Looks like v19.1 changes the way of loading fonts for a video with ass subtitle.

I am running a Raspberry Pi 4B with 1GB memory.  The software is LibreElec v10(w/ Kodi v19.1). This behavior easily exhausts the memory and crash the system.  In addition to that, even I reduce the number of fonts, the loading time for a video with ass subtitle is much larger than before.  Loading only required fonts is making more sense, IMO.  It has less memory footprint and also a lot less loading time.

Is it possible to change the behavior back to load only required fonts for that particular video?
Reply
#2
Just to update that with a 8GB Raspberry Pi 4 board, I could play the video with all font files enabled.  It uses around 950MB and sometimes will up to 1.5GB.  I believe this is the reason why the system crashes on a 1GB board.

The video takes a bit longer to load with all font files enabled, from 5s~15s.  I would expect it will take longer with more fonts.  With only the required fonts installed, the video starts immediately.  I still think it is the right way to go to load only the required fonts instead of scanning all font files for a ass subtitle.

Anyone could help with this?
Reply
#3
@owlhuang The first step is to provide a link to the full uncut Debug Log that reproduces the problem.
See instructions below.

To receive meaningful assistance you will need to provide a full debug log.

The instructions are here... debug log (wiki)

If you are using the Basic Method, then ensure the following is applied...
1.Enable debugging in Settings>System Settings>Logging,
2.Restart Kodi
3.Replicate the problem.
4.Upload the log to Kodi Paste Site manually or use the Kodi Logfile Uploader. (wiki) With either method post the link to the log back here.

If you are using the Advanced Method ensure you have correctly created and applied the advancedsettings.xml file (wiki)

In both instances, you should see the word DEBUG throughout the log.

Note: Full logs only. No partial or redacted logs
Do NOT post your logs directly into the forum. Use the Kodi Paste Site. Post the link to your pasted log in the forum
Reply
#4
Can you specify what directory path have you put the fonts?
Dev-Maintainer of InputStream Adaptive add-on, Netflix add-on ▫ Skills Python, C#, VB.NET and a bit of C++
Reply
#5
OP, I have been looking at ass font issues on Windows 10, and would be interested in seeing your debug log, though I don't know anything about Kodi on Raspberry Pi 4.  Also curious how you determined that the fonts were being "loaded".

scott s.
.
Reply
#6
it is not needed a RPI4 just install LibreELec or CoreElec
both use same fontconfig configuration

the problem is that Libass have two ways to load fonts
1) without a font provider
2) by using a font provider

in this case the problem is that
both method seems currently used in libass at same time
the method 1 point to kodi font user folder (/storage/.kodi/media/Fonts) it is used as fallback when there are no font providers in the OS
the method 2 point to the system font provider (inthis case fontconfig) configurated folders, currently LE and CE have set same fontconfig folder of method 1: /storage/.kodi/media/Fonts

this cause that the fonts are loaded twice

a fix could be this:
under etc/... , edit "05-kodi-fonts.conf" file and change the folder name to another name
then put all fonts in this new folder
(you cannot edit this file directly you need to unpack/repack the SYSTEM file or build your own CE/LE)

I'm trying to figure out if it's possible to make a change directly to libass sources
to prevent this problem and allow the use of the same folder without side effects
Dev-Maintainer of InputStream Adaptive add-on, Netflix add-on ▫ Skills Python, C#, VB.NET and a bit of C++
Reply
#7
Just to mention, I believe the LE guys are somewhat aware of the same fontconfig folder situation.

https://github.com/LibreELEC/LibreELEC.tv/pull/5462

Maybe something you can comment on to bring back to their attention.
Reply
#8
Thanks
i am cleaning up our patches of libass
as soon as i have paxxi's approval
i will report to LibreElec/CoreElec of the fonts folder situation
Dev-Maintainer of InputStream Adaptive add-on, Netflix add-on ▫ Skills Python, C#, VB.NET and a bit of C++
Reply
#9
(2021-09-13, 20:07)CastagnaIT Wrote: Can you specify what directory path have you put the fonts?

Sorry for the late response.  Am overwhelmed by the work these days.

The directory is at /storage/.kodi/media/Fonts for LibreElec.
Reply
#10
(2021-09-14, 23:07)scott967 Wrote: OP, I have been looking at ass font issues on Windows 10, and would be interested in seeing your debug log, though I don't know anything about Kodi on Raspberry Pi 4.  Also curious how you determined that the fonts were being "loaded".

scott s.
.

I enable log and see all fonts are loaded upon starting a video.
Reply
#11
(2021-09-08, 14:22)asavah Wrote: @owlhuang The first step is to provide a link to the full uncut Debug Log that reproduces the problem.
See instructions below.

To receive meaningful assistance you will need to provide a full debug log.

The instructions are here... debug log (wiki)

If you are using the Basic Method, then ensure the following is applied...
1.Enable debugging in Settings>System Settings>Logging,
2.Restart Kodi
3.Replicate the problem.
4.Upload the log to Kodi Paste Site manually or use the Kodi Logfile Uploader. (wiki) With either method post the link to the log back here.

If you are using the Advanced Method ensure you have correctly created and applied the advancedsettings.xml file (wiki)

In both instances, you should see the word DEBUG throughout the log.

Note: Full logs only. No partial or redacted logs
Do NOT post your logs directly into the forum. Use the Kodi Paste Site. Post the link to your pasted log in the forum

I will generate and upload the logs when I have time.  Sorry for not responding timely.
Reply
#12
For the record, I posted in LibreElect forum, too.  But I think it is more like a Kodi related topic.
https://forum.libreelec.tv/thread/24366-...post160949
Reply
#13
@owlhuang this need to be fixed by LibreElec team
Librelec currently do wrong things with fonts folder, then all fonts are loaded twice
this because they have a wrong FontConfig configuration.

There is a PR opened https://github.com/LibreELEC/LibreELEC.tv/pull/5462 to fix this problem
but the change point in the cache folder where instead shoud point in to a path where everyone can put his fonts (no matter how many fonts 300/500/1000...)

In short, with the mentioned PR LibreElec will have to provide a new folder where users can put fonts

In any case, for linux like LibreElec, the user folder "/storage/.kodi/media/Fonts" must not be used to place all these fonts
suggest to place max ~100 fonts to not have side effects like playback slowdown or system instability.

As long as Librelec does not approve this change, there will be no solution for users
and from Kodi side we cannot provide any other solution.
Dev-Maintainer of InputStream Adaptive add-on, Netflix add-on ▫ Skills Python, C#, VB.NET and a bit of C++
Reply

Logout Mark Read Team Forum Stats Members Help
[v19.1] Kodi loads all fonts instead of required ones on a video with ass subtitle0