SubtitleEdit/subtitleedit · error · InvalidOperationException
No PGS subtitles in MKV track #{track.TrackNumber}.
Error message
No PGS subtitles in MKV track #{track.TrackNumber}. What it means
Thrown by ImageOcrLoader.LoadMatroskaPgs when BluRaySupParser.ParseBluRaySupFromMatroska(track, matroska) returns an empty PCS list for the given MKV PGS track (codec S_HDMV/PGS). The track was selected as a PGS subtitle track but its embedded PGS data decoded to zero presentation composition segments, so there is nothing to OCR.
Source
Thrown at src/seconv/Core/ImageOcrLoader.cs:54
return PcsListToSubtitle(pcsList, null);
}
using var ocr = OcrEngineFactory.Create(options);
var isolationNote = options.PgsIsolateColors ? string.Empty : " (colour isolation off)";
AnsiConsole.MarkupLine($"[dim]Running {ocr.Name} OCR on {pcsList.Count} Blu-Ray sup image(s){isolationNote}...[/]");
return PcsListToSubtitle(pcsList, ocr, options.PgsIsolateColors);
}
/// <summary>
/// MKV PGS track (S_HDMV/PGS) → text via the configured OCR engine, or time codes only
/// when <see cref="ConversionOptions.TimeCodesOnly"/> is set.
/// </summary>
public static Subtitle LoadMatroskaPgs(MatroskaFile matroska, MatroskaTrackInfo track, ConversionOptions options)
{
var pcsList = BluRaySupParser.ParseBluRaySupFromMatroska(track, matroska);
if (pcsList.Count == 0)
{
throw new InvalidOperationException($"No PGS subtitles in MKV track #{track.TrackNumber}.");
}
if (options.TimeCodesOnly)
{
AnsiConsole.MarkupLine($"[dim]Extracting time codes from {pcsList.Count} MKV PGS image(s) (track #{track.TrackNumber}, no OCR)...[/]");
return PcsListToSubtitle(pcsList, null);
}
using var ocr = OcrEngineFactory.Create(options);
var isolationNote = options.PgsIsolateColors ? string.Empty : " (colour isolation off)";
AnsiConsole.MarkupLine($"[dim]Running {ocr.Name} OCR on {pcsList.Count} MKV PGS image(s) (track #{track.TrackNumber}){isolationNote}...[/]");
return PcsListToSubtitle(pcsList, ocr, options.PgsIsolateColors);
}
/// <summary>
/// Transport stream DVB-sub → text via the configured OCR engine, or time codes only
/// when <see cref="ConversionOptions.TimeCodesOnly"/> is set. Returns one Subtitle per
/// packet ID that has subtitles. Teletext PIDs are not handled here (they're alreadyView on GitHub (pinned to 17a9f07487)
Solutions
- Extract the PGS track to a standalone .sup (mkvextract / ffmpeg) and validate it with BDSup2Sub.
- Re-mux the MKV from the original Blu-ray source including the intact PGS track.
- If the track is empty/corrupt, select a different PGS track or re-extract subtitles from the source.
Defensive patterns
Strategy: try-catch
Validate before calling
// Extract the PGS track to .sup first and validate, then OCR the standalone file. // (No public pre-check for embedded PGS; rely on the loader guard.)
Try / catch
try { sub = ImageOcrLoader.LoadMatroskaPgs(matroska, track, options); }
catch (InvalidOperationException ex) when (ex.Message.Contains("No PGS subtitles in MKV track"))
{ AnsiConsole.MarkupLine($"[yellow]Skipping PGS track #{track.TrackNumber}: {ex.Message.EscapeMarkup()}[/]"); continue; } Prevention
- Extract the PGS track with mkvextract/ffmpeg and validate it with BDSup2Sub before OCR.
- Re-mux MKVs from the original source to preserve intact PGS payloads.
- Catch the InvalidOperationException per-track so other MKV tracks still convert.
When it happens
Trigger: Calling LoadMatroskaPgs(matroska, track, options) on an MKV PGS track whose payload contains no usable PCS entries (ImageOcrLoader.cs:55). Occurs with a corrupt/truncated PGS track or a track flagged S_HDMV/PGS that is actually empty.
Common situations: A PGS track truncated during muxing; an MKV whose PGS packets were corrupted by a faulty remux; a placeholder PGS track; a track whose PGS data is compressed/encoded in a way the parser rejects.
Related errors
- No Blu-Ray sup subtitles found in: {filePath}
- No VobSub subtitles in MKV track #{track.TrackNumber}.
- No subtitle tracks in Matroska file: {filePath}
- No subtitles recognised in Blu-Ray sup file: {filePath}
- Unable to access bitmap pixel data.
AI-assisted analysis of SubtitleEdit/subtitleedit@17a9f07487 (2026-08-13).
Data as JSON: /api/errors/646a20ea2f117375.
Report an issue: GitHub.