dvbsub/dvb_subtitle are missing from both IsImage lists, so DVB bitmap subtitles are routed down the text/libass path #733

Open
opened 2026-08-04 22:16:19 +02:00 by timothy · 0 comments
Owner

Found while fixing #726 (bitmap-subtitle -readrate starvation). Distinct defect, deliberately not folded into that fix.

The bug

Two places classify a subtitle as bitmap-vs-text, and both list the same six codecs:

  • ErsatzTV.Core/Domain/Metadata/Subtitle.cs:18
    public bool IsImage => Codec is "hdmv_pgs_subtitle" or "dvd_subtitle" or "dvdsub" or "vobsub" or "pgssub" or "pgs";
    
  • ErsatzTV.FFmpeg/InputFile.cs:95
    public bool IsImageBased => SubtitleStreams.All(s =>
        s.Codec is "hdmv_pgs_subtitle" or "dvd_subtitle" or "dvdsub" or "vobsub" or "pgssub" or "pgs");
    

dvbsub and dvb_subtitle are absent from both. DVB subtitles are a bitmap format, so they are being classified as text.

Consequence

IsImage picks the burn-in route at ErsatzTV.Core/FFmpeg/FFmpegLibraryProcessService.cs:353:

string path = subtitle.IsImage ? videoPath : subtitlePath;

so a dvbsub stream takes the text path — extraction plus the libass subtitles= filter — which cannot render a bitmap subtitle. FFmpegStreamSelector.cs:162-183 also requires an embedded text subtitle to have been extracted with a non-empty Path before it is even a candidate, so the likely observed behaviour is no subtitle rendered at all rather than a crash. That should be confirmed rather than assumed (see Done-when).

Population (prod, 2026-08-04)

Codec Streams
dvbsub 108
dvb_subtitle 1

Small — 109 of ~156k subtitle streams — which is why this has gone unnoticed. Hence priority: low.

Note for whoever picks this up

The duplicated codec list across two layers is the actual smell; a dvbsub added to one and not the other would produce a pipeline that disagrees with itself about which branch it is on. Prefer a single shared classifier over editing both lists in place.

Related: the ErsatzTV DB spells these differently from ffprobe (pgssub vs hdmv_pgs_subtitle, dvdsub vs dvd_subtitle) — both spellings appear in the lists above because both reach the code. Any fix must keep both.

Done-when

  • Confirmed observed behaviour for a real dvbsub item (no subtitle / broken render / something else) — recorded in the issue
  • dvbsub and dvb_subtitle classified as bitmap wherever bitmap-ness is decided
  • The two duplicated codec lists reconciled to a single source of truth (or an explicit, stated reason not to)
  • Regression test covering a dvbsub stream taking the overlay path
  • Adversarial review passed
  • Docs updated (or explicitly none required, with reason)
Found while fixing #726 (bitmap-subtitle `-readrate` starvation). Distinct defect, deliberately not folded into that fix. ## The bug Two places classify a subtitle as bitmap-vs-text, and both list the same six codecs: - `ErsatzTV.Core/Domain/Metadata/Subtitle.cs:18` ```csharp public bool IsImage => Codec is "hdmv_pgs_subtitle" or "dvd_subtitle" or "dvdsub" or "vobsub" or "pgssub" or "pgs"; ``` - `ErsatzTV.FFmpeg/InputFile.cs:95` ```csharp public bool IsImageBased => SubtitleStreams.All(s => s.Codec is "hdmv_pgs_subtitle" or "dvd_subtitle" or "dvdsub" or "vobsub" or "pgssub" or "pgs"); ``` **`dvbsub` and `dvb_subtitle` are absent from both.** DVB subtitles are a bitmap format, so they are being classified as text. ## Consequence `IsImage` picks the burn-in route at `ErsatzTV.Core/FFmpeg/FFmpegLibraryProcessService.cs:353`: ```csharp string path = subtitle.IsImage ? videoPath : subtitlePath; ``` so a `dvbsub` stream takes the **text** path — extraction plus the libass `subtitles=` filter — which cannot render a bitmap subtitle. `FFmpegStreamSelector.cs:162-183` also requires an embedded *text* subtitle to have been extracted with a non-empty `Path` before it is even a candidate, so the likely observed behaviour is **no subtitle rendered at all** rather than a crash. That should be confirmed rather than assumed (see Done-when). ## Population (prod, 2026-08-04) | Codec | Streams | |---|---| | `dvbsub` | 108 | | `dvb_subtitle` | 1 | Small — 109 of ~156k subtitle streams — which is why this has gone unnoticed. Hence `priority: low`. ## Note for whoever picks this up The duplicated codec list across two layers is the actual smell; a `dvbsub` added to one and not the other would produce a pipeline that disagrees with itself about which branch it is on. Prefer a single shared classifier over editing both lists in place. Related: the ErsatzTV DB spells these differently from ffprobe (`pgssub` vs `hdmv_pgs_subtitle`, `dvdsub` vs `dvd_subtitle`) — both spellings appear in the lists above because both reach the code. Any fix must keep both. ## Done-when - [ ] Confirmed observed behaviour for a real `dvbsub` item (no subtitle / broken render / something else) — recorded in the issue - [ ] `dvbsub` and `dvb_subtitle` classified as bitmap wherever bitmap-ness is decided - [ ] The two duplicated codec lists reconciled to a single source of truth (or an explicit, stated reason not to) - [ ] Regression test covering a `dvbsub` stream taking the overlay path - [ ] Adversarial review passed - [ ] Docs updated (or explicitly none required, with reason)
timothy added the bugpriority: low labels 2026-08-04 22:16:19 +02:00
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: timothy/ersatztv#733