Mpv: Custom fonts from linked segments aren't working

Created on 23 Jul 2018  路  17Comments  路  Source: mpv-player/mpv

mpv version and platform

mpv 0.28.0-633-g351c083487
Ubuntu 16.04 (KDE neon 5.13)

Reproduction steps

  1. Play the OP video directly (not from the episode videos). You'll notice its custom fonts are working just fine.
  2. Play any of the episode videos, then seek to OP. You'll notice it uses default fonts instead of the custom ones inside the OP video.

Expected behavior

Use the custom fonts.

Actual behavior

mpv used default fonts.

Log file

Playing the episode files: https://paste.fiery.me/ohenuculor (I skipped to the OP near the end)
Playing the OP video directly: https://paste.fiery.me/pukifegeji

Sample files

https://i.fiery.me/private/(Hi10)_K_Return_of_Kings_-_OP_(BD_1080p)_(Beatrice-Commie)_(321B942F).mkv
https://i.fiery.me/private/(Hi10)_K_Return_of_Kings_-_03_(BD_1080p)_(Beatrice-Hi10)_(2D5404D5).mkv
They aren't exactly the same files as the one I tested for the logs, but they got pretty much the same issue. Plus they both came from the same re-encoder.

All 17 comments

I don't know if it's relevant, but a friend tested SMPlayer on Windows. I assumed it has mpv shipped. Anyways, he also had the same issue (in fact he made me realize).

Yeah, I can reproduce this.
https://0x0.st/sVu2.txt
[ 8.053][v][sub/ass] fontselect: (Arkona-Regular, 400, 0) -> Arkona-Regular, 0, Arkona-Regular
https://0x0.st/sVu_.txt

[  10.686][i][sub/ass] fontselect: Using default font family: (Arkona-Regular, 400, 0) -> /usr/share/fonts/truetype/dejavu/DejaVuSans.ttf, 0, DejaVuSans
[  10.686][v][sub/ass] fontselect: (Arkona-Regular, 400, 0) -> /usr/share/fonts/truetype/dejavu/DejaVuSans.ttf, 0, DejaVuSans

I think mpv tries to load Arkona-Regular from the wrong place...

What does fc-match Arkona-Regular say? Could be a libass / fontconfiig problem?

$ fc-match Arkona-Regular
DejaVuSans.ttf: "DejaVu Sans" "Book"

In any case, Arkona-Regular is inside a "ordered chapter with segment linking" file.
(Hi10)_K_Return_of_Kings_-_OP_(BD_1080p)_(Beatrice-Commie)_(321B942F).mkv

I wonder if it's a regression of fontconfig (or has it always worked like this?):

$ fc-list | grep Sony
/system/fonts/SomcUDGothic-Regular.ttf: Sony Mobile UD Gothic Regular,Sony Mobile UD Gothic:style=Regular
$ fc-match
NimbusSans-Regular.otf: "Nimbus Sans" "Regular"
$ fc-match SomcUDGothic-Regular
NimbusSans-Regular.otf: "Nimbus Sans" "Regular"
$ fc-match Sony
NimbusSans-Regular.otf: "Nimbus Sans" "Regular"
$ fc-match "Sony Mobile"
NimbusSans-Regular.otf: "Nimbus Sans" "Regular"
$ fc-match "Sony Mobile UD"
NimbusSans-Regular.otf: "Nimbus Sans" "Regular"
$ fc-match "Sony Mobile UD Gothic"
SomcUDGothic-Regular.ttf: "Sony Mobile UD Gothic Regular" "Regular"
$ fc-match "Sony Mobile UD Gothic Regular"
SomcUDGothic-Regular.ttf: "Sony Mobile UD Gothic Regular" "Regular"
$
$ fc-match --version
fontconfig version 2.13.0
$

Well, I wouldn't expect fc-match to see it because it's not system-installed. The issue is just that mpv isn't loading fonts from the external segment. Using mkvmerge to put the font into the main file makes it show correctly.

Doesn't seem like a regression. Issue was present going back to at least v0.25 (more than a year ago), which is approximately the oldest that will compile against my currently installed ffmpeg. I'm sort of surprised that this has never worked. But it probably should. If I get a chance this week and nobody beats me to it, I'll see how hard it is...

6019 should fix this. Works for me on your sample, but please try it yourself if it's not too much trouble to compile.

Works for me too: https://0x0.st/sVlz.txt

I chose to wait for it being merged to master, but I suppose it's not the season yet, so I built it on my own. Can confirm that it's working well :+1:

So I'm new here and I want to know where do I use the script to make it work. Any help is appreciated . If possible could you give me the mpv build with this script.

$ git clone https://github.com/mpv-player/mpv.git
$ cd mpv
$ wget https://github.com/mpv-player/mpv/pull/6019.patch
$ patch -p1 < 6019.patch

And just build as usual...

Umm I tried but it show error when using that
patch -p1 < 6019.patch
bash patch: command not found

You may have to install patch from your distributions. It's installed by default on my machine (or some other package had that as a dependency? I honestly don't know).

I got through the patch error part by using
git apply 6019.patch
I've tried literally everything and I can't build it. Another error pops up as waf can't be opened or something like that. Let's hope this fix get's added in the next update.

Tbh instead of the conventional ways stated in the README, I used mpv-build to compile mpv instead.

Well I'll try and let you know

I can confirm that #6019 fixes the problem for me.

Was this page helpful?
0 / 5 - 0 ratings