justdan96 / tsMuxer

tsMuxer is a transport stream muxer for remuxing/muxing elementary streams, EVO/VOB/MPG, MKV/MKA, MP4/MOV, TS, M2TS to TS to M2TS. Supported video codecs H.264/AVC, H.265/HEVC, VC-1, MPEG2. Supported audio codecs AAC, AC3 / E-AC3(DD+), DTS/ DTS-HD.
Apache License 2.0
849 stars 144 forks source link

On Linux, use fontconfig to find font files. #606

Open rkjnsn opened 2 years ago

rkjnsn commented 2 years ago

tsMuxer currently appears to be hard-coded only to look for fonts in /usr/share/fonts/. This means that any fonts installed in other locations will lead to messages like “Can't find ttf file for font Liberation Sans” when selected. Worse, some distros don't have a /usr/share/fonts/ at all, which makes adding an srt subtitle track altogether impossible. Instead of using a fixed directory, tsMuxer should enumerate font files using fontconfig to pick up all installed font files regardless of their location.

Randrianasulu commented 2 years ago

I think you still can add full font path/name to ttf font you want to use in meta file (I used this method during testing), but yea, a bit more automation in this area will not hurt..

rkjnsn commented 2 years ago

Okay, specifying the full path to LiberationSans-Regular.ttf for the font-name in the meta file did allow muxing to complete, but somehow resulted in almost everything being rendered in italic.

Subtitles that are only partially italic seem to render correctly. E.g., this properly resulted in regular for “[person on speaker]” and italic for “Who are you?”:

1
00:00:14,139 --> 00:00:15,307
[person on speaker] <i>Who are you?</i>

However, everything else renders in italic, even with no tags. E.g., both of these are rendered in italic, even though only the first should be:

11
00:01:04,397 --> 00:01:06,650
<i>I wonder if you'd mind
taking a brief survey.</i>

12
00:01:07,943 --> 00:01:08,944
Who is that?

In contrast, if I mux on Windows using font-name="Arial", everything works correctly and only subtitles (or portions thereof) tagged with <i></i> are rendered in italic.