{"record":{"id":"2283bfa25d943c1f","repo":"SubtitleEdit/subtitleedit","slug":"no-blu-ray-sup-subtitles-found-in-filepath-2283bf","errorCode":null,"errorMessage":"No Blu-Ray sup subtitles found in: {filePath}","messagePattern":"No Blu-Ray sup subtitles found in: (.+?)","errorType":"exception","errorClass":"InvalidOperationException","httpStatus":null,"severity":"error","filePath":"src/seconv/Core/ImageOcrLoader.cs","lineNumber":30,"sourceCode":"\n/// <summary>\n/// OCR-driven loaders for image-based subtitle sources. Each method returns a Subtitle\n/// where each paragraph's text was recognised by Tesseract from the source's bitmap stream.\n/// </summary>\ninternal static class ImageOcrLoader\n{\n    /// <summary>\n    /// Blu-Ray .sup → text via the configured OCR engine. When\n    /// <see cref=\"ConversionOptions.TimeCodesOnly\"/> is set, OCR is skipped entirely and\n    /// each entry keeps its timing with empty text — no OCR engine is even created.\n    /// </summary>\n    public static Subtitle LoadBluRaySup(string filePath, ConversionOptions options)\n    {\n        var log = new StringBuilder();\n        var pcsList = BluRaySupParser.ParseBluRaySup(filePath, log);\n        if (pcsList.Count == 0)\n        {\n            throw new InvalidOperationException($\"No Blu-Ray sup subtitles found in: {filePath}\");\n        }\n\n        if (options.TimeCodesOnly)\n        {\n            AnsiConsole.MarkupLine($\"[dim]Extracting time codes from {pcsList.Count} Blu-Ray sup image(s) (no OCR)...[/]\");\n            return PcsListToSubtitle(pcsList, null);\n        }\n\n        using var ocr = OcrEngineFactory.Create(options);\n        var isolationNote = options.PgsIsolateColors ? string.Empty : \" (colour isolation off)\";\n        AnsiConsole.MarkupLine($\"[dim]Running {ocr.Name} OCR on {pcsList.Count} Blu-Ray sup image(s){isolationNote}...[/]\");\n        return PcsListToSubtitle(pcsList, ocr, options.PgsIsolateColors);\n    }\n\n    /// <summary>\n    /// MKV PGS track (S_HDMV/PGS) → text via the configured OCR engine, or time codes only\n    /// when <see cref=\"ConversionOptions.TimeCodesOnly\"/> is set.\n    /// </summary>","sourceCodeStart":12,"sourceCodeEnd":48,"githubUrl":"https://github.com/SubtitleEdit/subtitleedit/blob/17a9f0748781032255db3526b7215d2fb891e3af/src/seconv/Core/ImageOcrLoader.cs#L12-L48","documentation":"Thrown by ImageOcrLoader.LoadBluRaySup when BluRaySupParser.ParseBluRaySup(filePath, log) returns an empty PCS list — the .sup file yielded zero presentation composition segments. Without any PCS entries there are no images to OCR or time-code-extract, so the load aborts before creating an OCR engine.","triggerScenarios":"Calling LoadBluRaySup(filePath, options) on a .sup that the parser reads but finds no valid PCS in (ImageOcrLoader.cs:33). Happens with truncated/corrupt PGS files or a non-PGS file given a .sup extension.","commonSituations":"A truncated BD .sup (missing the PCS after the header); a .sup that is actually a different binary format; an empty or placeholder file; a PGS demuxed incorrectly so only window/colour segments survived.","solutions":["Validate the PGS with BDSup2Sub or FFmpeg to confirm PCS entries exist.","Re-demux the PGS stream from the original Blu-ray (MakeMKV/eac3to/ffmpeg -codec copy).","Confirm the file is genuinely a Blu-ray PGS .sup and not an HD-DVD or other variant."],"exampleFix":null,"handlingStrategy":"validation","validationCode":"// Pre-check PCS count before the OCR-bearing load.\nvar log = new StringBuilder();\nif (BluRaySupParser.ParseBluRaySup(filePath, log).Count == 0)\n    return Error($\"No Blu-Ray sup subtitles in: {filePath}\");","typeGuard":null,"tryCatchPattern":"try { sub = ImageOcrLoader.LoadBluRaySup(filePath, options); }\ncatch (InvalidOperationException ex) when (ex.Message.Contains(\"No Blu-Ray sup subtitles\"))\n{ Console.Error.WriteLine(ex.Message); continue; }","preventionTips":["Validate the PGS with BDSup2Sub/ffmpeg to confirm PCS entries before OCR.","Re-demux the PGS from the original Blu-ray if it is truncated.","Catch the InvalidOperationException to skip bad .sup files in batch jobs."],"tags":["blu-ray","sup","pgs","subtitle","ocr","no-content"],"backgroundTag":null,"analyzedSha":"17a9f0748781032255db3526b7215d2fb891e3af","analyzedAt":"2026-08-13T18:11:43.374Z","schemaVersion":2},"datasetVersion":"2026-08-13T19:17:28.613Z"}