mpv-player / mpv-player/mpv

Custom fonts not loaded properly with OC-only files

Open
#7,963 4 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

core:mkv core:subtitle
Dominant language
C
Stars
37k
Forks
3.5k
Avg merge
1d 10h
Merged PRs (30d)
22

Description

Important information

Matroska should allow for a file containing no streams, using only ordered chapters to play segments from other files. While mpv seems to handle most of this correctly, it fails to load fonts from the linked files unless the edition has at least a short bit from the main file itself.

Edition with three chapters: first two are linked to files in the same directory, last one is 1ms of black video + blank subtitle track from the main file. This is the expected behavior.
mpv-shot-OCs (blank at end)-001
mpv-shot-OCs (blank at end)-002

Same as above, but without the chapter from the main file itself. Second chapter fails to load fonts from the relevant file.
mpv-shot-OCs only-001
mpv-shot-OCs only-002

It does not appear to matter where in the timeline the main file's part is, as long as it exists.

Reproduced on Windows 10 using latest stable (mpv 0.32.0) and a recent build from git (mpv 0.32.0-201-ge7bab0025f). Also on Arch Linux with 0.32.0 (pacman: community mpv 1:0.32.0-4).

Related to #6009, but not the same issue.

Reproduction steps
  1. Using MKVToolNix or a similar tool, create two Matroska video files (A.mkv and B.mkv) with subtitles and embedded fonts (different font in each file).
  2. Create a third matroska file (OCs.mkv) with a single edition. Enable ordered chapters and add both of the files created in step 1. Make sure that these are the only two chapters.
  3. Open OCs.mkv with mpv, using --sub-font-provider=none to make sure mpv tries to use the embedded fonts instead of loading possibly installed fonts.
  4. Wait for the second chapter to start.
Expected behavior

Second chapter should look the same as if B.mkv had been opened by itself in mpv.

Actual behavior

Fonts embedded in B.mkv are not loaded, and mpv displays either a fallback font or simply no subtitles at all.

Log file

Log file: https://pastebin.com/p7R1q3Z6

Sample files

A.mkv: https://x0.at/Mlz.mkv
B.mkv: https://x0.at/Jkt.mkv
OCs.mkv: https://x0.at/ZkU.mkv
Same as OCs.mkv, but with a single ms chapter from the source file added: https://x0.at/Cjw.mkv

Contributor guide

No contributing guide indexed for this repository

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start by reproducing the issue with A.mkv, B.mkv, and OCs.mkv, using --sub-font-provider=none, and review the linked log file. Compare playback of B.mkv alone with its second ordered-chapter appearance in OCs.mkv; done means B.mkv's embedded fonts load without adding a chapter from the main file.

Written by the indexing model from the issue text.

Assessment

Tech stack
c
Domain
cli
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.