Plex ignores locally installed fonts on Linux when burning in subtitles

Server Version#: 1.32.3.7089
Player Version#: 1.69.1

Like the title suggestions on Linux when transcoding video and burning in subtitles it looks like Plex’s encoder uses a file located at /usr/lib/plexmediaserver/Resources/fonts.conf, which does not include any locally installed font files from /usr/share/fonts, nor does it uses any of the other related font-config directories.

My current workaround for this is to override /usr/lib/plexmediaserver/Resources/fonts.conf with the one located at /etc/fonts/font.conf, which seems to do the trick (until I restart the container and have to do it again…)

I know the problem here is niche, but this did used to work some time ago, but I’m unsure when this changed.

I understand the purpose of using /usr/lib/plexmediaserver/Resources/fonts.conf file is to use the fallback font files if nothing else exists, but you can add an import to the local /etc/fonts/font.conf into this file as well which should allow both the local fonts and the fallbacks to work in tandem, which can be done by adding this line to the file:

<include ignore_missing="yes">/etc/fonts/fonts.conf</include>
4 Likes

Bless your troubleshooting.

On a ReadyNAS this file is located at: /apps/plexmediaserver/Binaries/Resource/fonts.conf

1 Like

To add to this if anyone else is using a docker container and would like to use the workaround, you need to add the following volumes:

  - /usr/share/fonts:/usr/share/fonts:ro
  - /usr/share/fontconfig:/usr/share/fontconfig:ro
  - /var/cache/fontconfig:/var/cache/fontconfig:ro
  - /etc/fonts:/etc/fonts:ro

Then you can simply execute the following after the container comes up (and Plex is installed):

docker exec <container name> cp -f /etc/fonts/fonts.conf /usr/lib/plexmediaserver/Resources/fonts.conf

Personally I’ve added the following to my docker compose related scripts to automatically do this:

docker exec <container name> sh -c "sleep 300 && cp -f /etc/fonts/fonts.conf /usr/lib/plexmediaserver/Resources/fonts.conf" &

Seems to work okay.

2 Likes

@Sn0wCrack

I’m chatting with Engineering.

We’re trying to remember when this stopped working.
Do you know which version it stopped ? (“sometime in last 6 months” doesn’t help)

1 Like

I downgraded to 1.31.3.6868 to fix the issue

1 Like

ALL:

This is a regression.

I’ve been asked for logs.

Specifically, DEBUG logs, :

  1. One set with it working (highest Plex version which works)
  2. One set with it not working for the same file & playback conditions.

I’ve been authorized to give this a priority 1 for Triage.
Please help me help you.

“Downgrading to fix the issue” isn’t a fix.

1 Like

Thanks for figuring this out! I couldn’t follow your suggestion because my system (Unraid) doesn’t have /usr/share/fonts or any of the other fontconfig stuff, so I did some digging of my own. Plex (apparently) ships the Noto Sans font in /usr/lib/plexmediaserver/Resources/Fonts, but for whatever reason is not configured to use it by default for subtitles. The solution for me was as simple as adding

<match><edit mode="prepend" name="family"><string>Noto Sans</string></edit></match>

to /usr/lib/plexmediaserver/Resources/fonts.conf. I modified my startup scripts to do that automatically and now I’ve got good-looking subs again. Thanks for pointing me in the right direction!

3 Likes

I’ll try to grab some logs from the latest version and earliest working version in a bit (took me a while to find one that actually worked)

I’ve found the earliest version that works for me is: 1.24.5.5173-8dcc73a59

I attempted to use the following versions and they produced the same issue:

  • 1.32.3.7089
  • 1.31.3.6868-28fc46b27
  • 1.30.0.6486-629d58034
  • 1.29.0.6244-819d3678c
  • 1.28.0.5999-97678ded3
  • 1.25.0.5282-2edd3c44d

The /usr/lib/plexmediaserver/Resources/fonts.conf file appears to be the same across all of these versions from what I can see as well.

The only notable difference I found was with the filter_complex argument passed to the transcoder on the working version is slightly different, lacking the force_divisible_by=4 argument.

1.24.5.5173-8dcc73a59:

[0:0]scale=w=1492:h=1080[0];[0]format=pix_fmts=nv12[1];[1]inlineass=font_scale=1.000000:font_path=/usr/lib/plexmediaserver/Resources/Fonts/DejaVuSans-Regular.ttf:fontconfig_file=/usr/lib/plexmediaserver/Resources/fonts.conf:language=en[2];[2]hwupload[3]

1.31.3.6868-28fc46b27:

[0:0]scale=w=1492:h=1080:force_divisible_by=4[0];[0]format=pix_fmts=nv12[1];[1]inlineass=font_scale=1.000000:font_path=/usr/lib/plexmediaserver/Resources/Fonts/NotoSans-Medium.otf:fontconfig_file=/usr/lib/plexmediaserver/Resources/fonts.conf:language=en[2];[2]hwupload[3]
1 Like

I’ve attached the logs of a broken and working version below for Plex Media Server.log and Plex Transcoder Statistics.log

Both should only contain information from roughly around the time of playback (within a couple minutes or so), in which I played the same video from the start to around 30 seconds in.

working-1.24.5.5173-logs.zip (82.2 KB)
broken-1.32.3.7089-logs.zip (92.6 KB)

1 Like

@Sn0wCrack

Thank you.

I’m adding them to the internal ticket now.
Please leave these files here.

1 Like

@Sn0wCrack & all

Apparently I am mistaken (not the first nor will be the last. :rofl: )

Engineering is requiring more information because they state PMS never used system-installed fonts.

They want to see BEFORE and AFTER screenshots showing it working and then the failure.

To save another back & forth round, please also include the font name (exactly as identified) and XML (<media> section only) of the file shown in the screenshots. The XML allows them to see what PMS sees.

Both sets of debug log files (just to dot & cross the last I’s and T’s is also helpful)

1 Like

Here are some screenshots from the Plex Web Player of it working and not:

1.32.3.7089, Broken:

1.24.5.5173-8dcc73a59, Working:

Here is the XML output from both the broken and working versions as well.

1.32.3.7089, Broken:

<Media id="41800" duration="1453451" bitrate="3273" width="1492" height="1080" aspectRatio="1.33" audioChannels="2" audioCodec="flac" videoCodec="hevc" videoResolution="1080" container="mkv" videoFrameRate="24p" videoProfile="main 10">
	<Part accessible="1" exists="1" id="48599" key="/library/parts/48599/1666500144/file.mkv" duration="1453451" file="/data/anime/Mobile Suit Zeta Gundam/Season 1/Mobile Suit Z Gundam - 34 (BDRip 1492x1080p x265 HEVC FLACx2 2.0x2)(Dual Audio)[sxales].mkv" size="596279848" container="mkv" deepAnalysisVersion="6" requiredBandwidths="4678,4566,4566,4566,4566,4566,4566,4566" videoProfile="main 10">
		<Stream id="181591" streamType="1" default="1" codec="hevc" index="0" bitrate="2345" bitDepth="10" chromaLocation="left" chromaSubsampling="4:2:0" codedHeight="1080" codedWidth="1496" colorPrimaries="bt709" colorRange="tv" colorSpace="bt709" colorTrc="bt709" frameRate="23.976" height="1080" level="120" profile="main 10" refFrames="1" requiredBandwidths="3696,3639,3639,3639,3639,3639,3639,3639" width="1492" displayTitle="1080p (HEVC Main 10)" extendedDisplayTitle="1080p (HEVC Main 10)"></Stream>
		<Stream id="181592" streamType="2" selected="1" default="1" codec="flac" index="1" channels="2" bitrate="338" language="Japanese" languageTag="ja" languageCode="jpn" audioChannelLayout="stereo" bitDepth="16" requiredBandwidths="381,381,381,381,381,381,381,381" samplingRate="48000" displayTitle="Japanese (FLAC Stereo)" extendedDisplayTitle="Japanese (FLAC Stereo)"></Stream>
		<Stream id="181593" streamType="2" codec="flac" index="2" channels="2" bitrate="589" language="English" languageTag="en" languageCode="eng" audioChannelLayout="stereo" bitDepth="16" requiredBandwidths="802,802,802,802,802,802,802,802" samplingRate="48000" displayTitle="English (FLAC Stereo)" extendedDisplayTitle="English (FLAC Stereo)"></Stream>
		<Stream id="181594" streamType="3" selected="1" default="1" codec="ass" index="3" bitrate="0" language="English" languageTag="en" languageCode="eng" requiredBandwidths="1,1,1,1,1,1,1,1" displayTitle="English (ASS)" extendedDisplayTitle="English (ASS)"></Stream>
	</Part>
</Media>

1.24.5.5173-8dcc73a59, Working:

<Media id="41800" duration="1453451" bitrate="3273" width="1492" height="1080" aspectRatio="1.33" audioChannels="2" audioCodec="flac" videoCodec="hevc" videoResolution="1080" container="mkv" videoFrameRate="24p" videoProfile="main 10">
    <Part accessible="1" exists="1" id="48599" key="/library/parts/48599/1666500144/file.mkv" duration="1453451" file="/data/anime/Mobile Suit Zeta Gundam/Season 1/Mobile Suit Z Gundam - 34 (BDRip 1492x1080p x265 HEVC FLACx2 2.0x2)(Dual Audio)[sxales].mkv" size="596279848" container="mkv" deepAnalysisVersion="6" requiredBandwidths="4678,4566,4566,4566,4566,4566,4566,4566" videoProfile="main 10">
        <Stream id="181591" streamType="1" default="1" codec="hevc" index="0" bitrate="2345" bitDepth="10" chromaLocation="left" chromaSubsampling="4:2:0" codedHeight="1080" codedWidth="1496" colorPrimaries="bt709" colorRange="tv" colorSpace="bt709" colorTrc="bt709" frameRate="23.976" height="1080" level="120" profile="main 10" refFrames="1" requiredBandwidths="3696,3639,3639,3639,3639,3639,3639,3639" width="1492" displayTitle="1080p (HEVC Main 10)" extendedDisplayTitle="1080p (HEVC Main 10)"></Stream>
        <Stream id="181592" streamType="2" selected="1" default="1" codec="flac" index="1" channels="2" bitrate="338" language="Japanese" languageTag="ja" languageCode="jpn" audioChannelLayout="stereo" bitDepth="16" requiredBandwidths="381,381,381,381,381,381,381,381" samplingRate="48000" displayTitle="Japanese (FLAC Stereo)" extendedDisplayTitle="Japanese (FLAC Stereo)"></Stream>
        <Stream id="181593" streamType="2" codec="flac" index="2" channels="2" bitrate="589" language="English" languageTag="en" languageCode="eng" audioChannelLayout="stereo" bitDepth="16" requiredBandwidths="802,802,802,802,802,802,802,802" samplingRate="48000" displayTitle="English (FLAC Stereo)" extendedDisplayTitle="English (FLAC Stereo)"></Stream>
        <Stream id="181594" streamType="3" selected="1" default="1" codec="ass" index="3" bitrate="0" language="English" languageTag="en" languageCode="eng" requiredBandwidths="1,1,1,1,1,1,1,1" displayTitle="English (ASS)" extendedDisplayTitle="English (ASS)"></Stream>
    </Part>
</Media>

Specifically in this case the MKV is only missing a single font that is used by the ASS file, which is “Open Sans”, all other embedded fonts render correctly on both 1.32.3.7089 and 1.24.5.5173.

I’ve also attached the subtitle and font files from the MKV just in case you might need it:
subtitle and font.zip (704.4 KB)


An aside from the above issue, I’ve also done some further playing around and noticed even if I don’t mount in my local font folders into the docker container, this font actually renders correctly in version 1.24.5.5173-8dcc73a59, so it seems like even without my local fonts “Open Sans” seems to render fine on this older version.

I have another show that I tried which I have a locally installed font, it seems to not render when mounting in my local font directories on 1.24.5.5173-8dcc73a59.

This leads me to believe that the reason 1.24.5.5173-8dcc73a59 works for my copy of Zeta Gundam is unrelated to using locally installed fonts or not, and just seems to be a coincidence, I probably should have verified this sooner but didn’t think of it until tonight.

I would like to mention however, when I do overwrite or modify the /usr/lib/plexmediaserver/Resources/fonts.conf file in the ways I previously mentioned, it does render the locally installed font regardless of version I use.

1 Like

Please attach a sample file that you have verified reproduces the issue. This means a video file containing an affected subtitle track and fonts, not an archive containing the extracted data. Make sure to also include screenshots and logs showing the behavior being reproduced on the sample (not the original it was derived from).

It looks like a similar issue is being discussed in this thread:

The post linked has what you’re looking for. If you need a new one, I can provide that as well when I get back to a computer…

Apologies for that, I’ve attached a quick test file I’ve made, which on subtitle burn-in, or on an operating system without the font installed, produces the following output:

open_sans_issue.zip (7.4 KB)

1 Like

Worked like a charm. Tks a lot!

Hello, having a bit of trouble following this on my Synology NAS, should it be the same file name etc? Thanks.

1 Like

The folders where Plex installs are different for each system.

If you’re using Plex natively on a NAS you’d want to look up the Plex directory using this guide: https://support.plex.tv/articles/202915258-where-is-the-plex-media-server-data-directory-located/

And then you should find a “Resources” folder that has font.conf inside of it.

On a Synology, there’s no easy way to get to where DSM installs PMS.
You need to do it via the command line

–AND–

it only endures until the next update.
(DSM removes the old files as it installs the new files)

@ChuckPa fair enough, ill wait until hopefully a patch fixes this issue soon