Skip to content

v1.13.0

Latest

Choose a tag to compare

@DPilat-Dev DPilat-Dev released this 18 Sep 04:12

PGS subtitles arrive in seconds instead of minutes — or not at all.

Reported as subtitles that took a long time, never appeared, and then restarted the film. It turned out to be four separate bugs.

The wait

The first request for a subtitle track inside a Matroska file does not return a file; it starts one being made, and the server sends nothing until it finishes. That takes about 8.6 seconds per gigabyte of container, whatever the subtitle format — so a 30 GB film means four and a half minutes, and a 74 GB one means ten.

The renderer allowed sixty seconds for all of it: a worker starting, a several-megabyte download, and that extraction. Long enough to be a wait, never long enough to succeed. On expiry it fell back to burning the track in, which rebuilds the stream and restarts the film — and aborting destroyed the extraction that was still running, so the next attempt began from nothing.

The choice

Waiting more gracefully is not enough when the wait is minutes. The cost is decided by the file, not the format, and PGS only ever feels slow because PGS only exists in Blu-ray remuxes. So the decision is now made per file: small enough and the track is drawn here, instantly switchable and adjustable; large enough and the server burns it in, which extracts nothing and starts in a few seconds.

Measured on cold films: 1.7 s, 2.5 s, 5.9 s, 8.3 s to playing, against 75 s, 267 s, 74 s and 82 s of extraction before. Episodes keep the renderer and cost 4–10 seconds.

This is the same call jellyfin-web makes — it has this renderer too, behind a setting that ships turned off.

Two more, found on the way

  • Asking for a burn-in did nothing while the device profile declared pgssub as handled here. The server took that at its word and delivered externally, so the subtitle arrived by neither route.
  • Choosing a track reverted it. Automatic selection re-ran on the new stream that burning in produced, and put the preferred language straight back. Nothing appeared to change because it changed twice.

Also

The message while waiting stops claiming it is loading after twelve seconds and says the server is preparing them, and that it only happens once.