title: ffmpeg burned-in subtitles render in the wrong font
body: <p>Trying to burn in subtitles to a video in FFMPEG in GothamProBold font. No matter what I do it keeps reverting to Helvetica. From the console, I see that FFMPEG seems to load the font without error. Then switches over to font provider &quot;coretext&quot;</p>
  <pre><code>[Parsed_subtitles_0 @ 0x7fed054048c0] Loading font file '/Projects/Fonts/GothaProBol.otf'
  [Parsed_subtitles_0 @ 0x7fed054048c0] Using font provider coretext
  [Parsed_subtitles_0 @ 0x7fed054048c0] fontselect: (GothaProBol.otf, 400, 0) -&gt; /System/Library/Fonts/Helvetica.ttc, -1, Helvetica
  </code></pre>
  <p>It seems like it has my font loaded, then loads what is likely a system default of Helvetica instead. My guess is that my chosen font isn't <strong>actually</strong> loading after all.</p>
  <p>FFMPEG command (called from python) is as follows:</p>
  <pre><code>ffmpeg_cmd = [&quot;ffmpeg&quot;, 
                &quot;-i&quot;, self.source_video_uri, 
                &quot;-y&quot;,
                &quot;-c:v&quot;, &quot;prores&quot;, &quot;-profile:v&quot;, &quot;1&quot;, 
                &quot;-c:a&quot;, &quot;pcm_s16be&quot;, 
                &quot;-vf&quot;, f&quot;subtitles={srt_uri}:fontsdir=/Projects/Fonts:force_style='Fontname=GothaProBol.otf'&quot;,
                f&quot;{self.source_video_uri}_render.mov&quot;]
  
  subprocess.call(ffmpeg_cmd)
  </code></pre>
  <p>Any ideas?</p>
  <p><strong>UPDATE</strong>: Found this setting in libass header file &quot;ass.h&quot; - which ffmpeg calls when using the subtitle filter. Don't know how to actually <em>set</em> this variable when ffmpeg calls libass, but here it is. Line 182:</p>
  <pre><code> * \brief Default Font provider to load fonts in libass' database
   *
   * NONE don't use any default font provider for font lookup
   * AUTODETECT use the first available font provider
   * CORETEXT force a CoreText based font provider (OS X only)
   * FONTCONFIG force a Fontconfig based font provider
   *
   * libass uses the best shaper available by default.
   */
  typedef enum {
      ASS_FONTPROVIDER_NONE       = 0,
      ASS_FONTPROVIDER_AUTODETECT = 1,
      ASS_FONTPROVIDER_CORETEXT,
      ASS_FONTPROVIDER_FONTCONFIG,
      ASS_FONTPROVIDER_DIRECTWRITE,
  } ASS_DefaultFontProvider;
  </code></pre>
  <p><strong>RE: ANSWER BELOW:</strong> For the most part, it seems that if your font is installed in /System/Fonts or /Library/Fonts then CoreText can find it. Though in some cases, the naming conventions can be quite particular and non-intuitive. It also can't seem to find all fonts, necessarily.</p>
  <p>For example: Gotham Pro Bold, in the /Library/Fonts folder on my system, file named &quot;GothaProBol.otf&quot; is <em>correctly</em> passed to fontname as: GothamPro-Bold or just Gotham Pro. Gotham Pro Bold, GothamPro, Gotham Pro-Bold, GothaProBol, and GothaProBol.otf do NOT work.</p>
  <p>For most fonts it seems the preferred convention is {FontName}-{Style/Weight} as displayed in Mac OS's FontBook, not the filename.</p>
  <p>That said, I have a novelty 'Game of Thrones.ttf' font in the same folder as Gotham Pro, and I can't get CoreText to connect to it under any of the above naming conventions.</p>