From 5bc55af0272e51b4fbc8cf84ba9a4cd68ec7f35f Mon Sep 17 00:00:00 2001 From: Shadowghost Date: Tue, 22 Sep 2026 17:17:58 +0200 Subject: [PATCH] Serve graphical subtitles as raw files with range support --- .../Controllers/SubtitleController.cs | 61 ++++++-- .../Controllers/SubtitleControllerTests.cs | 137 ++++++++++++++++++ 2 files changed, 187 insertions(+), 11 deletions(-) create mode 100644 tests/Jellyfin.Api.Tests/Controllers/SubtitleControllerTests.cs diff --git a/Jellyfin.Api/Controllers/SubtitleController.cs b/Jellyfin.Api/Controllers/SubtitleController.cs index c4851091c1..6721cd6c7e 100644 --- a/Jellyfin.Api/Controllers/SubtitleController.cs +++ b/Jellyfin.Api/Controllers/SubtitleController.cs @@ -233,18 +233,17 @@ public class SubtitleController : BaseJellyfinApiController format = "json"; } - if (string.IsNullOrEmpty(format)) + // Graphical subtitles cannot be parsed or rewritten, so they are always delivered as the raw + // stream for the client to render. Serve them straight from disk instead of piping them + // through the encoder, so that range requests keep working: clients fetch these tracks + // incrementally while rendering them, and they are far too large to hand over in one piece. + if (MediaStream.IsPgsFormat(format) || MediaStream.IsVobSubFormat(format)) { - var item = _libraryManager.GetItemById