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
865 stars 147 forks source link

MacOS: Can't find ttf file for font ... #459

Closed Selur closed 3 years ago

Selur commented 3 years ago

On MacOS Big Sur I get: "Can't find ttf file for font Arial" in the GUI in the "Subittle->Font->Select Font dialog" Arial is shown. ls /Library/Fonts/*.ttf
just shows:

/Library/Fonts/Arial Unicode.ttf

using:

MUXOPT --no-pcr-on-video-pid --new-audio-pes --hdmv-descriptors --vbr --vbv-len=500

V_MPEG4/ISO/AVC, "/Users/selur/Desktop/temp/[Vivid-Asenshi] Violet Evergarden - 01 [B58CEB69] (1)-001_2021-09-16@15_06_09_7910_02.264", fps=23.976, insertSEI, contSPS, ar=1:1 (Square), lang=eng

S_TEXT/UTF8, "/Users/selur/Desktop/special characters.srt",font-name=Arial,font-size=60,font-color=0x00FFFFFF,font-charset=1,bottom-offset=16,font-border=1,text-align=center,video-width=1280,video-height=720,fps=23.976

aborts with "Can't find ttf file for font Arial" and

MUXOPT --no-pcr-on-video-pid --new-audio-pes --hdmv-descriptors --vbr --vbv-len=500

V_MPEG4/ISO/AVC, "/Users/selur/Desktop/temp/[Vivid-Asenshi] Violet Evergarden - 01 [B58CEB69] (1)-001_2021-09-16@15_06_09_7910_02.264", fps=23.976, insertSEI, contSPS, ar=1:1 (Square), lang=eng

S_TEXT/UTF8, "/Users/selur/Desktop/special characters.srt",font-name=Arial Unicode,font-size=60,font-color=0x00FFFFFF,font-charset=1,bottom-offset=16,font-border=1,text-align=center,video-width=1280,video-height=720,fps=23.976

aborts with "Can't find ttf file for font Arial Unicode"

Cu Selur

Ps.: used the latest nightly and patched tsMuxeR, libfreetype.6 and libpng16.16 to get it running.

justdan96 commented 3 years ago

Can you try running it with strace? It looks like /Library/Fonts/ is the correct folder, can you also check if it errors out with any other fonts?

Selur commented 3 years ago

Nope, since at least on my MacOS system there is no strace. :)

I tried: sudo dtruss "/Users/selur/workspace/Hybrid/Hybrid.app/Contents/MacOS/tsMuxeR" "/Users/selur/Desktop/temp/tsMuxerMeta_2021-09-16@16_08_34_4710__03.meta" "/Users/selur/Desktop/[Vivid-Asenshi] Violet Evergarden - 01 [B58CEB69] (1)-001.m2ts but the output doesn't seem useful: https://pastebin.com/YiBgLaxa

I also tried:

sudo trace -E  "/Users/selur/workspace/Hybrid/Hybrid.app/Contents/MacOS/tsMuxeR" "/Users/selur/Desktop/temp/tsMuxerMeta_2021-09-16@16_08_34_4710__03.meta" "/Users/selur/Desktop/[Vivid-Asenshi] Violet Evergarden - 01 [B58CEB69] (1)-001.m2ts"

but that failed too with:

Starting program: /Users/selur/workspace/Hybrid/Hybrid.app/Contents/MacOS/tsMuxeR
trace error: trace facility failure, KERN_KDENABLE: trace buffer is uninitialized
Selur commented 3 years ago

I could also try dtrace in case someone can tell me how to.

sudo dtrace -c "/Users/selur/workspace/Hybrid/Hybrid.app/Contents/MacOS/tsMuxeR" "/Users/selur/Desktop/temp/tsMuxerMeta_2021-09-16@16_08_34_4710__03.meta" "/Users/selur/Desktop/[Vivid-Asenshi] Violet Evergarden - 01 [B58CEB69] (1)-001.m2ts"

only gave me:

dtrace: system integrity protection is on, some features will not be available

dtrace: no probes `specified
Selur commented 3 years ago

not sure whether it helps but these are the contents of my fons folders:

ls /Library/Fonts 
Arial Unicode.ttf
ls /System/Library/Fonts 
Apple Braille Outline 6 Dot.ttf         ArialHB.ttc                 Keyboard.ttf                    NewYork.ttf                 PingFang.ttc                    Supplemental                    ヒラギノ角ゴシック W3.ttc
Apple Braille Outline 8 Dot.ttf         Avenir Next Condensed.ttc           Kohinoor.ttc                    NewYorkItalic.ttf               SFCompact.ttf                   Symbol.ttf                  ヒラギノ角ゴシック W4.ttc
Apple Braille Pinpoint 6 Dot.ttf        Avenir Next.ttc                 KohinoorBangla.ttc              Noteworthy.ttc                  SFCompactItalic.ttf             Thonburi.ttc                    ヒラギノ角ゴシック W5.ttc
Apple Braille Pinpoint 8 Dot.ttf        Avenir.ttc                  KohinoorGujarati.ttc                NotoNastaliq.ttc                SFCompactRounded.ttf                Times.ttc                   ヒラギノ角ゴシック W6.ttc
Apple Braille.ttf               Courier.dfont                   KohinoorTelugu.ttc              NotoSansArmenian.ttc                SFNS.ttf                    TimesLTMM                   ヒラギノ角ゴシック W7.ttc
Apple Color Emoji.ttc               GeezaPro.ttc                    LastResort.otf                  NotoSansKannada.ttc             SFNSItalic.ttf                  ZapfDingbats.ttf                ヒラギノ角ゴシック W8.ttc
Apple Symbols.ttf               Geneva.dfont                    LucidaGrande.ttc                NotoSansMyanmar.ttc             SFNSMono.ttf                    ヒラギノ丸ゴ ProN W4.ttc            ヒラギノ角ゴシック W9.ttc
AppleSDGothicNeo.ttc                HelveLTMM                   MarkerFelt.ttc                  NotoSansOriya.ttc               SFNSMonoItalic.ttf              ヒラギノ明朝 ProN.ttc
AquaKana.ttc                    Helvetica.ttc                   Menlo.ttc                   NotoSerifMyanmar.ttc                SFNSRounded.ttf                 ヒラギノ角ゴシック W0.ttc
ArabicUIDisplay.ttc             HelveticaNeue.ttc               Monaco.dfont                    Optima.ttc                  STHeiti Light.ttc               ヒラギノ角ゴシック W1.ttc
ArabicUIText.ttc                Hiragino Sans GB.ttc                MuktaMahee.ttc                  Palatino.ttc                    STHeiti Medium.ttc              ヒラギノ角ゴシック W2.ttc

~/Library/Fonts/ is empty.


neither using "Arial" "Arial Unicode" or "SFCompact" does work. -> where does tsMuxeR look for the fonts it tries to use?

radioproektor commented 3 years ago

There are 3 places on macOS where fonts are located: /System/Library/Fonts contains system fonts. That folder usually remains untouched. /Library/Fonts contains additional fonts and fonts installed by different apps. User can install fonts to that folder. There is an Arial Unicode.ttf font in that folder. ~/Library/Fonts/ is usually empty by default. User can install fonts to that folder.

jcdr428 commented 3 years ago

@justdan96 looks similar to #170.

Selur commented 3 years ago

Yeah looks similar, but why does 'Arial Unicode' then not work? (since it's already in /Library/Fonts ?

jcdr428 commented 3 years ago

@Selur just a thought: can you try lower case "arial unicode" ? Edit: strike that. Here is the code in textSubtitlesRenderFT.cpp creating the error message, if it can help:

        string fontName = font.m_name;
        if (!strEndWith(fontName, string(".ttf")))
        {
            std::string fontLower = strToLowerCase(fontName);
            map<string, string>::iterator itr = m_fontNameToFile.find(fontLower);
            if (itr != m_fontNameToFile.end())
                fontName = itr->second;
            else
                THROW(ERR_COMMON, "Can't find ttf file for font " << fontName);
        }
Selur commented 3 years ago

nope, neither arial unicode nor arial unicode.ttf or Arial Unicode.ttf works Also tried "Arial Unicode.ttf".

Selur commented 3 years ago

Here's the output of system_profiler SPFontsDataType fonts.txt

Does the routine filling m_fontNameToFile also collect files from symlinks? Since "Arial Unicode.ttf" is a symlink: Arial Unicode.ttf -> /System/Library/Fonts/Supplemental/Arial Unicode.ttf`

Nope that isn't the issue, copied /System/Library/Fonts/Supplemental/Arial Narrow Bold.ttf

    Arial Narrow Bold.ttf:

      Kind: TrueType
      Valid: Yes
      Enabled: Yes
      Location: /System/Library/Fonts/Supplemental/Arial Narrow Bold.ttf
      Typefaces:
        ArialNarrow-Bold:
          Full Name: Arial Narrow Bold
          Family: Arial Narrow
          Style: Bold
          Version: Version 2.38.1x
          Vendor: The Monotype Corporation
          Unique Name: Arial Narrow Bold : 2007
          Designer: Robin Nicholas, Patricia Saunders
          Copyright: © 2007 The Monotype Corporation. All Rights Reserved.
          Trademark: Arial is a trademark of The Monotype Corporation in the United States and/or other countries.
          Description: Monotype Drawing Office 1982. A contemporary sans serif design, Arial contains more humanist characteristics than many of its predecessors and as such is more in tune with the mood of the last decades of the twentieth century. The overall treatment of curves is softer and fuller than in most industrial-style sans serif faces. Terminal strokes are cut on the diagonal which helps to give the face a less mechanical appearance. Arial is an extremely versatile family of typefaces which can be used with equal success for text setting in reports, presentations, magazines etc, and for display use in newspapers, advertising and promotions.
          Outline: Yes
          Valid: Yes
          Enabled: Yes
          Duplicate: No
          Copy Protected: No
          Embeddable: Yes

to /Library/Fonts but Arial Narrow Bold also fails.

Can't find ttf file for font Arial Narrow Bold

When I use Arial Narrow in the .meta file I (unexpectedly) get:

Can't load charset 1 for font /Library/Fonts/Arial Narrow Bold.ttf

Is there may be some mixup between Full Name: Arial Narrow Bold and Family: Arial Narrow ?

Selur commented 3 years ago

I had a quick look at the source code.

m_fontNameToFile is a map which maps fontFamiles to file names (1:1).

...
string fontFamily = strToLowerCase(font->family_name);
...
m_fontNameToFile[fontFamily] = fileList[i];

https://github.com/justdan96/tsMuxer/blob/8474c6b01d0ce416b26b2a4f35258e8803a9bc36/tsMuxer/osdep/textSubtitlesRenderFT.cpp#L99

So '/Library/Fonts/Arial Narrow Bold.ttf', would be saved as:

m_fontNameToFile["Arial Narrow"] = "/Library/Fonts/Arial Narrow Bold.ttf"

-> The name fontNameToFile is misleading as it should be "m_fontFamilyToFile".

Problem is that in setFont(..): https://github.com/justdan96/tsMuxer/blob/8474c6b01d0ce416b26b2a4f35258e8803a9bc36/tsMuxer/osdep/textSubtitlesRenderFT.cpp#L207

if (!strEndWith(fontName, string(".ttf")))
{
    std::string fontLower = strToLowerCase(fontName);
    map<string, string>::iterator itr = m_fontNameToFile.find(fontLower);
    if (itr != m_fontNameToFile.end())
        fontName = itr->second;
    else
        THROW(ERR_COMMON, "Can't find ttf file for font " << fontName);
}

the fontName is used to itrate over "m_fontNameToFile". -> Unless fontName=fontFamily=fileName this constuct will cause problems.

justdan96 commented 3 years ago

Thanks for checking that. Is there a default font on MacOS which has that fontName=fontFamily=fileName pattern?

radioproektor commented 3 years ago

Problem could be due font file name vs actual font name used inside font file. For example if you open Arial Unicode.ttf font file in system Font Book.app - it give you some additional info about real font name. So you may try to use Arial Unicode MS or ArialUnicodeMS Screen Shot 2021-09-17 at 11 40 57 PM

Selur commented 3 years ago

Looking over the fonts.txt I attached above https://github.com/justdan96/tsMuxer/issues/459#issuecomment-921516926 There seem to be a few.

    Tahoma.ttf:

      Kind: TrueType
      Valid: Yes
      Enabled: Yes
      Location: /System/Library/Fonts/Supplemental/Tahoma.ttf
      Typefaces:
        Tahoma:
          Full Name: Tahoma
          Family: Tahoma
          Style: Regular
          Version: Version 5.01.2x
          Vendor: Microsoft Corporation
          Unique Name: Microsoft Tahoma Regular
          Designer: Matthew Carter
          Copyright: © 2006 Microsoft Corporation. All rights reserved.
          Trademark: Tahoma is either a registered trademark or a trademark of Microsoft Corporation in the United States and/or other countries.
          Outline: Yes
          Valid: Yes
          Enabled: Yes
          Duplicate: No
          Copy Protected: No
          Embeddable: Yes
    Ayuthaya.ttf:

      Kind: TrueType
      Valid: Yes
      Enabled: Yes
      Location: /System/Library/Fonts/Supplemental/Ayuthaya.ttf
      Typefaces:
        Ayuthaya:
          Full Name: Ayuthaya
          Family: Ayuthaya
          Style: Regular
          Version: 13.0d1e7
          Unique Name: Ayuthaya; 13.0d1e7; 2017-06-12
          Copyright: Copyright © 1992-2011 by Apple Inc. All rights reserved.
          Outline: Yes
          Valid: Yes
          Enabled: Yes
          Duplicate: No
          Copy Protected: No
          Embeddable: Yes
    Verdana.ttf:

      Kind: TrueType
      Valid: Yes
      Enabled: Yes
      Location: /System/Library/Fonts/Supplemental/Verdana.ttf
      Typefaces:
        Verdana:
          Full Name: Verdana
          Family: Verdana
          Style: Regular
          Version: Version 5.01x
          Vendor: Carter & Cone
          Unique Name: Microsoft:Verdana Regular:Version 5.01x (Microsoft)
          Designer: Matthew Carter
          Copyright: © 2006 Microsoft Corporation. All Rights Reserved.
          Trademark: Verdana is either a registered trademark or a trademark of Microsoft Corporation in the United States and/or other countries.
          Outline: Yes
          Valid: Yes
          Enabled: Yes
          Duplicate: No
          Copy Protected: No
          Embeddable: Yes
    Trebuchet MS.ttf:

      Kind: TrueType
      Valid: Yes
      Enabled: Yes
      Location: /System/Library/Fonts/Supplemental/Trebuchet MS.ttf
      Typefaces:
        TrebuchetMS:
          Full Name: Trebuchet MS
          Family: Trebuchet MS
          Style: Regular
          Version: Version 5.00x
          Vendor: Microsoft Corporation
          Unique Name: Microsoft Trebuchet
          Designer: Vincent Connare
          Copyright: © 2006 Microsoft Corporation. All Rights Reserved.
          Description: Trebuchet, designed by Vincent Connare in 1996, is a humanist sans serif designed for easy screen readability. Trebuchet takes its inspiration from the sans serifs of the 1930s which had large x heights and round features intended to promote readability on signs. The typeface name is credited to a puzzle heard at Microsoft, where the question was asked, "could you build a Trebuchet (a form of medieval catapult) to launch a person from the main campus to the consumer campus, and how?" The Trebuchet fonts are intended to be the vehicle that fires your messages across the Internet. "Launch your message with a Trebuchet page".
          Outline: Yes
          Valid: Yes
          Enabled: Yes
          Duplicate: No
          Copy Protected: No
          Embeddable: Yes
    Arial Narrow.ttf:

      Kind: TrueType
      Valid: Yes
      Enabled: Yes
      Location: /System/Library/Fonts/Supplemental/Arial Narrow.ttf
      Typefaces:
        ArialNarrow:
          Full Name: Arial Narrow
          Family: Arial Narrow
          Style: Regular
          Version: Version 2.38.1x
          Vendor: The Monotype Corporation
          Unique Name: Arial Narrow Regular : 2007
          Designer: Robin Nicholas, Patricia Saunders
          Copyright: © 2007 The Monotype Corporation. All Rights Reserved.
          Trademark: Arial is a trademark of The Monotype Corporation in the United States and/or other countries.
          Description: Monotype Drawing Office 1982. A contemporary sans serif design, Arial contains more humanist characteristics than many of its predecessors and as such is more in tune with the mood of the last decades of the twentieth century. The overall treatment of curves is softer and fuller than in most industrial-style sans serif faces. Terminal strokes are cut on the diagonal which helps to give the face a less mechanical appearance. Arial is an extremely versatile family of typefaces which can be used with equal success for text setting in reports, presentations, magazines etc, and for display use in newspapers, advertising and promotions.
          Outline: Yes
          Valid: Yes
          Enabled: Yes
          Duplicate: No
          Copy Protected: No
          Embeddable: Yes

But those seem to come from Catalina, where they were in another folder,.. see also: https://www.macworld.com/article/233868/font-chaos-in-macos-catalina-and-how-to-deal-with-it.html

My guess is the best way would probably to ship some fonts as ressources in tsMuxeR itself and use those.


@radioproektor: yes, that was established in my last posts.

jcdr428 commented 3 years ago

@Selur Maybe replace:

        if (error == 0)
        {
            string fontFamily = strToLowerCase(font->family_name);

            std::map<std::string, std::string>::iterator itr = m_fontNameToFile.find(fontFamily);

            if (itr == m_fontNameToFile.end())
                m_fontNameToFile[fontFamily] = fileList[i];
            else if (fileList[i].length() < itr->second.length())
                m_fontNameToFile[fontFamily] = fileList[i];

            FT_Done_Face(font);
        }

with:

        if (error == 0)
        {
            string fontName = strToLowerCase(font->family_name);
            fontName.append(strToLowerCase(font->style_name));

            std::map<std::string, std::string>::iterator itr = m_fontNameToFile.find(fontName);

            if (itr == m_fontNameToFile.end())
                m_fontNameToFile[fontName] = fileList[i];

            FT_Done_Face(font);
        }

I can't test on Windows.

Selur commented 3 years ago

@jcdr428 : that's only the collecting part. The main problem is than in setFont(..) the code assumes that the file name does hold any meaning. So your idea to save the files with "Family+Full Name" is only one part of the solution. One would also have to access the m_fontNameToFile map accordingly. Also there should either be an option do specify a custom font folder, or all the default font folders (on Windows/Linux/Mac) should be used to collect the fonts.

jcdr428 commented 3 years ago

@Selur can you please try artifact https://github.com/jcdr428/tsMuxer/suites/3802883975/artifacts/93922869

Also there should either be an option do specify a custom font folder, or all the default font folders (on Windows/Linux/Mac) should be used to collect the fonts.

One thing at a time :)

Selur commented 3 years ago

Will test tomorrow and report back. Already on my way to bed ;)

radioproektor commented 3 years ago

@jcdr428, Artifact https://github.com/jcdr428/tsMuxer/suites/3802883975/artifacts/93922869 will not work because it also needs a fix with statically linked libraries. Problem was already fixed in this thread https://github.com/justdan96/tsMuxer/issues/458#issuecomment-920830284

jcdr428 commented 3 years ago

@radioproektor this is a docker build, from #458 I understood that those builds don't have the issue ?

Edit: artifact from my master https://github.com/jcdr428/tsMuxer/suites/3804893995/artifacts/93996462

Selur commented 3 years ago

@jcdr428 : Okay, which artifact should I try and what value for 'font-name=' should I use in the .meta file?

Selur commented 3 years ago

I tried: https://github.com/jcdr428/tsMuxer/suites/3802883975/artifacts/93922869 with 'Arial Unicode' and got Can't find ttf file for font Arial Unicode analog for 'Arial', 'Arial Narrow', 'Arial Narrow Bold', 'Arial Unicode MS' I copied "/System/Library/Fonts/Supplemental/Arial Narrow.ttf" to "/Library/Fonts/" and called 'Arial Narrow', but that didn't help either.

I copied "/System/Library/Fonts/Supplemental/Trebuchet MS.ttf" to "/Library/Fonts/" and called 'Trebuchet MS', but that didn't help either.

Aside from the symlink to 'Arial Unicode.ttf' I removed the files inside /Library/Fonts/ again.

jcdr428 commented 3 years ago

@Selur :( as I don't have access to a Mac I can't trace. All I can do is include some debug messages so that you can report the console output.

Selur commented 3 years ago

@jcdr428: I'm happy to run some build with debug messages and share the output if you create the artifacts. :)

jcdr428 commented 3 years ago

@Selur having played around with the fonts: As stated by @radioproektor, font-name= must be the familly name.

To use file Arial Unicode.ttf, set in meta file font-name=Arial Unicode MS

tsMuxer selects the file with the shortest length, so if you set font-name=Arial Narrow and have Arial Narrow.ttf, Arial Narrow Bold.ttf and Arial Narrow Italic.ttf, tsMuxer will select Arial Narrow.ttf.

Use the charset as defined in https://www.freetype.org/freetype2/docs/reference/ft2-base_interface.html#ft_encoding e.g. font-charset=FT_ENCODING_UNICODE

Selur commented 3 years ago

Sorry, but I do not get it. Either I miss something or this does not work on Catalina and newer macOS . Note that radioproektor is using and old 10.14 macOS . macOS 10.14: Mojave - 24 September 2018 macOS 10.15: Catalina - 7 October 2019 macOS 11: Big Sur - 12 November 2020 macOS 12: Monterey - ETA October 2021 (announced 7 June 2021) I'm on macOS 11.

using: https://github.com/jcdr428/tsMuxer/suites/3802883975/artifacts/93922869 ls -la /Library/Fonts

total 16
drwxrwxr-t   4 root   admin   128 Sep 18 10:12 .
drwxr-xr-x  66 root   wheel  2112 Sep 16 08:27 ..
-rw-r--r--@  1 selur  admin  6148 Sep 18 10:12 .DS_Store
lrwxr-xr-x   1 root   wheel    52 Jan  1  2020 Arial Unicode.ttf -> /System/Library/Fonts/Supplemental/Arial Unicode.ttf

and using:

MUXOPT --no-pcr-on-video-pid --new-audio-pes --hdmv-descriptors --vbr --vbv-len=500

V_MPEG4/ISO/AVC, "/Users/selur/Desktop/temp/[Vivid-Asenshi] Violet Evergarden - 01 [B58CEB69] (1)-001_2021-09-16@16_08_34_4710_02.264", fps=23.976, insertSEI, contSPS, ar=1:1 (Square), lang=eng

S_TEXT/UTF8, "/Users/selur/Desktop/special characters.srt",font-name=Arial Unicode MS,font-size=60,font-color=0x00FFFFFF,font-charset=FT_ENCODING_UNICODE,bottom-offset=16,font-border=1,text-align=center,video-width=1280,video-height=720,fps=23.976

gives me:

Can't find ttf file for font Arial Unicode MS
jcdr428 commented 3 years ago

@Selur forget my patch, just use the latest justdan release https://github.com/justdan96/tsMuxer/suites/3717847453/artifacts/90910984

Selur commented 3 years ago

@jcdr428: Okay, I downloaded https://github.com/justdan96/tsMuxer/suites/3717847453/artifacts/90910984 and patched it to be usable (freetype&co). I used

MUXOPT --no-pcr-on-video-pid --new-audio-pes --hdmv-descriptors --vbr --vbv-len=500

V_MPEG4/ISO/AVC, "/Users/selur/Desktop/temp/[Vivid-Asenshi] Violet Evergarden - 01 [B58CEB69] (1)-001_2021-09-16@16_08_34_4710_02.264", fps=23.976, insertSEI, contSPS, ar=1:1 (Square), lang=eng

S_TEXT/UTF8, "/Users/selur/Desktop/special characters.srt",font-name=Arial Unicode MS,font-size=60,font-color=0x00FFFFFF,font-charset=FT_ENCODING_UNICODE,bottom-offset=16,font-border=1,text-align=center,video-width=1280,video-height=720,fps=23.976

and got:

tsMuxeR version git-8474c6b. github.com/justdan96/tsMuxer
Can't find ttf file for font Arial Unicode MS

I then deleted "/Library/Fonts/Arial Unicode.ttf" (this symlink was created by macOS not me) and copied "/System/Library/Fonts/Supplemental/Arial Unicode.ttf" to "/Library/Fonts/" that gave me:

tsMuxeR version git-8474c6b. github.com/justdan96/tsMuxer
Decoding H264 stream (track 1): Profile: High@5.0  Resolution: 1280:720p  Frame rate: 23.976
B-pyramid level 1 detected. Shift DTS to 2 frames
0.0% complete
H264 bitstream changed: insert nal unit delimiters
H264 bitstream changed: insert pict timing and buffering period SEI units
Decoding PGS stream (track 2):  Resolution: 1280:720  Frame rate: 23.976
H264 bitstream changed: insert SPS/PPS units
92.5% complete
Processed 7218 video frames
100.0% complete
Flushing write buffer
Mux successful complete
Muxing time: 1 sec

Subtitles are there and properly displayed.

-> So the problems are: a. tsMuxeR can't handle symlinks. tsMuxeR should alway use "QDir(path).canonicalPath()" to get the real path. b. tsMuxeR only searches /Library/Fonts, which (starting with Catalina) is typically only populated with symlinks. tsMuxeR should populate the fontsMap by searching:

jcdr428 commented 3 years ago

@Selur Ok quick and dirty solution, in textSubtitlesRenderFT.cpp we could change:

    vector<string> fileList;
    findFilesRecursive(FONT_ROOT, "*.ttf", &fileList);

with:

    vector<string> fileList;
    findFilesRecursive(FONT_ROOT, "*.ttf", &fileList);
    #if defined(__APPLE__) && defined(__MACH__)
    vector<string> fileList1;
    findFilesRecursive("/Sytem/Library/Fonts/", "*.ttf", &fileList1);
    fileList.insert(fileList.end(), fileList1.begin(), fileList1.end());
    findFilesRecursive("~/Library/Fonts/", "*.ttf", &fileList1);
    fileList.insert(fileList.end(), fileList1.begin(), fileList1.end());
    #endif
Selur commented 3 years ago

additionally you should replace: m_fontNameToFile[fontName] = fileList[i]; with m_fontNameToFile[fontName] = QDir(fileList[i]).canonicalPath(); to always get the real path not some symlink or similar.

jcdr428 commented 3 years ago

@Selur please try https://github.com/jcdr428/tsMuxer/suites/3810222232/artifacts/94165951

Note that because of the error:

/Users/runner/work/tsMuxer/tsMuxer/tsMuxer/osdep/textSubtitlesRenderFT.cpp:106:65: error: 'canonical' is unavailable: introduced in macOS 10.15
                m_fontNameToFile[fontFamily] = std::__fs::filesystem::canonical(fileList[i]).string();

I had to increase the OS version to macOS 10.15.

Selur commented 3 years ago

@jcdr428 : works fine here 👍 (even if the font is from system font folder: /System/Library/Fonts/Supplemental/) @radioproektor: can you try whether this works still in macOS 10.14? @jcdr428: can you make a statically linked version for radioproektor, since I assume he might not know how to patch tsMuxeR, libfreetype and libpng to get the non statically linked version running.

radioproektor commented 3 years ago

So it will not run on macOS 10.14 will even if patch it to statically linked version? P.S. yes, i don't know how to patch it to linked version

Selur commented 3 years ago

The static linking is unrelated to the macOS10.15 change. It might still work on macOS10.14, Apple isn't there totally precise,..

jcdr428 commented 3 years ago

@Selur ok I'll push the part related to the folders. As for the simlink, I won't push for the moment, pending an alternative solution to the filesystem canonical class to convert to absolute paths. @justdan96, maybe you know how to do this without breaking compatibility with MacOS 13 ?

radioproektor commented 3 years ago

I just wonder why developers change things from statically linked version to external libraries. This only adds complexity and confusion. Older tsMuxer versions where statically linked and all worked fine from single executable file.

jcdr428 commented 3 years ago

@radioproektor I'll leave @justdan96 to fix the static linking, I don't know how to fix it.

Edit: I've opened issues #462 and #463 to separate from this issue. I close this issue.

justdan96 commented 3 years ago

@radioproektor the versions of tsMuxer built in the Docker container are statically linked, the Mac native builds are dynamically linked as I haven't got around to looking at fixing those yet.