{"record":{"id":"4ca819f723d933de","repo":"SubtitleEdit/subtitleedit","slug":"output-filename-can-only-target-a-single-dvb-sub","errorCode":null,"errorMessage":"--output-filename can only target a single DVB-sub PID. Found {streams.Count} PIDs in the transport stream.","messagePattern":"--output-filename can only target a single DVB-sub PID\\. Found (.+?) PIDs in the transport stream\\.","errorType":"exception","errorClass":"InvalidOperationException","httpStatus":null,"severity":"error","filePath":"src/seconv/Core/SubtitleConverter.cs","lineNumber":510,"sourceCode":"        // (ContainerSubtitleLoader.LoadTransportStream) honors this by gating its DVB-sub\n        // load on !options.TeletextOnly; this preserve path has to do the same or the\n        // flag is bypassed whenever the target is an image format.\n        if (options.TeletextOnly)\n        {\n            await Task.CompletedTask;\n            return false;\n        }\n\n        var streams = BitmapSubtitleLoader.LoadTransportStreamDvbSub(inputFile);\n        if (streams.Count == 0)\n        {\n            // No DVB-sub PIDs found; let the regular container loader handle teletext / etc.\n            return false;\n        }\n\n        if (streams.Count > 1 && !string.IsNullOrEmpty(options.OutputFilename))\n        {\n            throw new InvalidOperationException(\n                \"--output-filename can only target a single DVB-sub PID. Found \"\n                + $\"{streams.Count} PIDs in the transport stream.\");\n        }\n\n        foreach (var (items, pid) in streams)\n        {\n            // PID is the natural per-stream identifier. ResolveOutputFileName only embeds\n            // languageSuffix into the filename stem (trackNumber is only used as the\n            // de-duplication fallback for overwrite collisions), so pass the PID *as* the\n            // language suffix to keep each PID's output stably named — otherwise multiple\n            // PIDs would collide and only differ by an opaque \"_2\", \"_3\" rotation.\n            var outputFile = ResolveOutputFileName(inputFile, options, languageSuffix: $\"dvb_pid{pid}\", trackNumber: pid);\n\n            if (!options.Quiet)\n            {\n                AnsiConsole.MarkupInterpolated($\"[dim]{fileIndex}:[/] [cyan]{Path.GetFileName(inputFile)}[/] [yellow]PID {pid} [/][dim](DVB img→img)→[/] [green]{outputFile}[/]...\");\n            }\n","sourceCodeStart":492,"sourceCodeEnd":528,"githubUrl":"https://github.com/SubtitleEdit/subtitleedit/blob/17a9f0748781032255db3526b7215d2fb891e3af/src/seconv/Core/SubtitleConverter.cs#L492-L528","documentation":"Thrown by seconv's transport-stream DVB-sub passthrough path when a .ts/.m2ts contains more than one DVB-subtitle PID and --output-filename is set. Each PID needs its own output file, so a single fixed output name would collide; the loader refuses rather than silently dropping streams.","triggerScenarios":"PassThroughTransportStreamDvbAsync finds streams.Count > 1 from BitmapSubtitleLoader.LoadTransportStreamDvbSub, AND options.OutputFilename is non-empty, AND --teletext-only is not active.","commonSituations":"Converting a broadcast .ts capture carrying several DVB subtitle languages (one PID each) to an image format while pinning a single output name with --output-filename.","solutions":["Remove --output-filename and let each PID auto-name with the dvb_pid{N} suffix.","Pre-filter the stream to a single PID upstream (there is no --track-number equivalent for TS PIDs, so rely on auto-naming or split the .ts first).","Point --output-folder at a dedicated directory instead of fixing one filename."],"exampleFix":"// before\nseconv capture.ts dvbsub --output-filename out.sub\n// after (auto-name per PID)\nseconv capture.ts dvbsub --output-folder ./out","handlingStrategy":"validation","validationCode":"// Pre-count DVB-sub PIDs before fixing the output name\nvar pids = BitmapSubtitleLoader.LoadTransportStreamDvbSub(inputFile);\nif (!string.IsNullOrEmpty(options.OutputFilename) && pids.Count > 1)\n    throw new ArgException(\"TS has \" + pids.Count + \" DVB PIDs; drop --output-filename or split the stream.\");","typeGuard":"null","tryCatchPattern":"null","preventionTips":["Never combine --output-filename with multi-PID TS input.","Use --output-folder so each PID auto-names with the dvb_pid{N} suffix.","Split multi-PID .ts with ffmpeg/tsduck first if you must pin a single output name."],"tags":["seconv","transport-stream","dvb-sub","cli-flags","argument-validation"],"backgroundTag":null,"analyzedSha":"17a9f0748781032255db3526b7215d2fb891e3af","analyzedAt":"2026-08-13T18:11:43.374Z","schemaVersion":2},"datasetVersion":"2026-08-13T19:17:28.613Z"}