ASS subtitle video stops to work when .kodi/media/Fonts contains too many fonts

  • Hi everyone,

    I am seeing an issue when there are too many fonts in the .kodi/media/Fonts directory. When I started a video with ass subtitle, kodi starts to load ALL fonts into memory. This causes a out of memory and hang/reboot the device.

    The device I am using is a Raspberry Pi 4B with 1GB memory. LibreElec is version 10RC1, 9.97.1. I didn't see this behavior on 10 beta 1. I am not quite sure if the issue starts in beta 2 or beta 3. Is anyone seeing similar issue?

    -Dennis

  • 1GB is on the low side these days no matter what. The 1GB version of the RPi and also other devices have proven to give problems in video processing. Try getting the 2 or 4GB version if possible.

    How many fonts are there in your ./Fonts folder, how much are the file sizes combined?

  • Sorry for the late reply.

    I am getting a 8GB model and hope that helps. I will update when I have the new board.

    To answer above questions, I have around 775MB of fonts for ass subtitles. I know it sounds a lot for most people. But most of them are fonts for Chinese characters for anime. Each one would be easily between 5MB~10MB, some are over 30MB. Also each anime video uses different fonts. So it adds up rather quickly.

    The interesting thing is LibreElec 10.0b2 (Kodi v19.0) doesn't have this problem. It only loads the fonts used by that particular video. Starting with LibreElec 10.0b3 (Kodi v19.1), it loads ALL fonts under .kodi/media/Fonts when a video starts. This not only causes unnecessary huge memory consumption but also increases the load time of that video (from loading all fonts.) The original design makes more sense, IMO.

    I agree 1GB is rather small for today's hardware. But without ASS subtitles, LibreElec runs just almost perfectly with 1GB RPi 4. Having more memory just for loading fonts for ASS doesn't seem to be reasonable. Also with a large collection of video mentioned above, the font directory would grow very quickly. That would also increase the loading time dramatically for a video, too.

    I might need more information on why a ram disk would help here. I thought a ram disk would eat up some memory and leaves even less for loading fonts, and crash even faster.

  • Just want to update with the new 8GB board, I can play the video with all font files enabled. The maximum memory usage I see from top is about 1.5GB. It usually hovers around 950MB with a video with ass subtitles.

    The video does take a bit longer to start, about 5~15s. If I remove all font files but the one required, it starts immediately.

  • I am getting a 8GB model and hope that helps. I will update when I have the new board.

    The extra RAM shouldn't be necessary for LibreELEC, but if it works... You could also run other OSes more easily with the 8GB memory.

    Kodi had a large PR bump requested in the subtitles department a few days ago. Not sure if it's gonna be available for Kodi 19.2+, otherwise it's gonna be Kodi 20...

  • Sorry for the slow response. Got overwhelmed by work these days.

    I am good with 8GB as workaround right now. It might become a problem (both on loading time and memory footprint) when the number of fonts increases. I am curious why Kodi changes to load all fonts upon a video starts. Behavior on previous version makes more sense to me. Hope the new subtitle code improves in this regard.

    This should be a Kodi related issue instead of LibreElect. I posted in Kodi forum, too, for some helps. Here is the link to be cross-referenced.