Answers.Body: <p>MPC-HC uses <a href="https://sourceforge.net/projects/guliverkli/" rel="nofollow noreferrer">VSFilter</a> to render subtitles, while FFmpeg uses <a href="https://github.com/libass/libass" rel="nofollow noreferrer">Libass</a> and you encountered a bug that wasn't known at the time and was happening because Libass was querying GDI-enumerated fonts by family name instead of full name. This behaviour on exactly this font was tracked in <a href="https://github.com/libass/libass/issues/744" rel="nofollow noreferrer">issue #744</a>.</p>
  <p>The bug was resolved in Libass version 0.17.2 (while yours was 0.17.0), so probably people won't experience it again, but if anyone somehow got here, then just update your FFmpeg to newer.</p>
  
Answers.ContentLicense: CC BY-SA 4.0
Answers.CreationDate: 2024-12-21T12:07:27.103Z
Answers.LastActivityDate: 2024-12-21T12:07:27.103Z
Answers.UserDisplayName: Jukizuka
Body: <p>I created an .ass file with specified font (SF Pro Semibold) and wanted to merge with a video.</p>
  <p>.ass file:</p>
  <pre class="lang-bash prettyprint-override"><code>[V4+ Styles]
  Format: Name, Fontname, Fontsize, PrimaryColour, SecondaryColour, OutlineColour, BackColour, Bold, Italic, Underline, StrikeOut, ScaleX, ScaleY, Spacing, Angle, BorderStyle, Outline, Shadow, Alignment, MarginL, MarginR, MarginV, Encoding
  Style: videoaltyazi,SF Pro Semibold,75.0,&amp;H00CDCDCD,&amp;H0000FFFF,&amp;H00000000,&amp;H00000000,0,0,0,0,100,100.0,0.0,0,3,10.5,3.0,2,10,10,120,1
  </code></pre>
  <p>FFmpeg can actually detect the font either specifying the location of font or not.</p>
  <pre class="lang-bash prettyprint-override"><code>PS &gt; ffmpeg -i input.mp4 -vf ass=sub.ass:fontsdir=&quot;.\subtitle\SF-Pro-Display-Semibold.otf&quot; output.mp4
  ffmpeg version 6.0-full_build-www.gyan.dev Copyright (c) 2000-2023 the FFmpeg developers
    built with gcc 12.2.0 (Rev10, Built by MSYS2 project)
  ...
  [Parsed_ass_0 @ 000001c267a2d180] libass API version: 0x1700000
  [Parsed_ass_0 @ 000001c267a2d180] libass source: commit: 0.17.0-39-g04a208d5d200360d2ac75f8f6cfc43dd58dd9225
  [Parsed_ass_0 @ 000001c267a2d180] Shaper: FriBidi 1.0.12 (SIMPLE) HarfBuzz-ng 7.0.1 (COMPLEX)
  [Parsed_ass_0 @ 000001c267a2d180] Using font provider directwrite (with GDI)
  [Parsed_ass_0 @ 000001c267a2d180] Added subtitle file: 'sub.ass' (2 styles, 1 events)
  ...
  [Parsed_ass_0 @ 000001c267a2d180] fontselect: (SF Pro Semibold, 400, 0) -&gt; SFPro-Semibold, 0, SFPro-Semibold
  </code></pre>
  <p>But subtitle font of output video is not Sf Pro Semibold. It's just look like SF Pro.</p>
  <p>When I drag subtitle file to original video in MPC-HC, subtitle just look like what I want. I edited a screenshot in ShareX and used font I guess. Here is the comparison:</p>
  <p><a href="https://i.imgur.com/78iedb7.png" rel="nofollow noreferrer"><img src="https://i.imgur.com/78iedb7.png" alt="enter image description here" /></a></p>
  <p>How can I use the font I want?</p>
  
Tags: <ffmpeg><subtitles>
Title: FFmpeg ass filter doesn't use font i choose
UserDisplayName: miqheil
ThreadText: # FFmpeg ass filter doesn't use font i choose
  
  (Asked by: username_0 on 2023-07-02)
  
  I created an .ass file with specified font (SF Pro Semibold) and wanted to merge with a video.
  
  .ass file:
  
  ```bash
  [V4+ Styles]
  Format: Name, Fontname, Fontsize, PrimaryColour, SecondaryColour, OutlineColour, BackColour, Bold, Italic, Underline, StrikeOut, ScaleX, ScaleY, Spacing, Angle, BorderStyle, Outline, Shadow, Alignment, MarginL, MarginR, MarginV, Encoding
  Style: videoaltyazi,SF Pro Semibold,75.0,&H00CDCDCD,&H0000FFFF,&H00000000,&H00000000,0,0,0,0,100,100.0,0.0,0,3,10.5,3.0,2,10,10,120,1
  
  ```
  
  FFmpeg can actually detect the font either specifying the location of font or not.
  
  ```bash
  PS > ffmpeg -i input.mp4 -vf ass=sub.ass:fontsdir=".\subtitle\SF-Pro-Display-Semibold.otf" output.mp4
  ffmpeg version 6.0-full_build-www.gyan.dev Copyright (c) 2000-2023 the FFmpeg developers
    built with gcc 12.2.0 (Rev10, Built by MSYS2 project)
  ...
  [Parsed_ass_0 @ 000001c267a2d180] libass API version: 0x1700000
  [Parsed_ass_0 @ 000001c267a2d180] libass source: commit: 0.17.0-39-g04a208d5d200360d2ac75f8f6cfc43dd58dd9225
  [Parsed_ass_0 @ 000001c267a2d180] Shaper: FriBidi 1.0.12 (SIMPLE) HarfBuzz-ng 7.0.1 (COMPLEX)
  [Parsed_ass_0 @ 000001c267a2d180] Using font provider directwrite (with GDI)
  [Parsed_ass_0 @ 000001c267a2d180] Added subtitle file: 'sub.ass' (2 styles, 1 events)
  ...
  [Parsed_ass_0 @ 000001c267a2d180] fontselect: (SF Pro Semibold, 400, 0) -> SFPro-Semibold, 0, SFPro-Semibold
  
  ```
  
  But subtitle font of output video is not Sf Pro Semibold. It's just look like SF Pro.
  
  When I drag subtitle file to original video in MPC-HC, subtitle just look like what I want. I edited a screenshot in ShareX and used font I guess. Here is the comparison:
  
  [![enter image description here](https://i.imgur.com/78iedb7.png)](https://i.imgur.com/78iedb7.png)
  
  How can I use the font I want?
  
  **Tags:** ffmpeg, subtitles
  
  
  ---
  
  ## 1 answers
  
  ### Answer by username_1 on 2024-12-21. Score: 2
  
  MPC-HC uses [VSFilter](https://sourceforge.net/projects/guliverkli/) to render subtitles, while FFmpeg uses [Libass](https://github.com/libass/libass) and you encountered a bug that wasn't known at the time and was happening because Libass was querying GDI-enumerated fonts by family name instead of full name. This behaviour on exactly this font was tracked in [issue #744](https://github.com/libass/libass/issues/744).
  
  The bug was resolved in Libass version 0.17.2 (while yours was 0.17.0), so probably people won't experience it again, but if anyone somehow got here, then just update your FFmpeg to newer.
  
  
  ---
  
  