SubtitleEdit/subtitleedit · error · InvalidOperationException

--output-filename can only target a single DVB-sub PID. Foun

Error message

--output-filename can only target a single DVB-sub PID. Found {streams.Count} PIDs in the transport stream.

What it means

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.

Source

Thrown at src/seconv/Core/SubtitleConverter.cs:510

        // (ContainerSubtitleLoader.LoadTransportStream) honors this by gating its DVB-sub
        // load on !options.TeletextOnly; this preserve path has to do the same or the
        // flag is bypassed whenever the target is an image format.
        if (options.TeletextOnly)
        {
            await Task.CompletedTask;
            return false;
        }

        var streams = BitmapSubtitleLoader.LoadTransportStreamDvbSub(inputFile);
        if (streams.Count == 0)
        {
            // No DVB-sub PIDs found; let the regular container loader handle teletext / etc.
            return false;
        }

        if (streams.Count > 1 && !string.IsNullOrEmpty(options.OutputFilename))
        {
            throw new InvalidOperationException(
                "--output-filename can only target a single DVB-sub PID. Found "
                + $"{streams.Count} PIDs in the transport stream.");
        }

        foreach (var (items, pid) in streams)
        {
            // PID is the natural per-stream identifier. ResolveOutputFileName only embeds
            // languageSuffix into the filename stem (trackNumber is only used as the
            // de-duplication fallback for overwrite collisions), so pass the PID *as* the
            // language suffix to keep each PID's output stably named — otherwise multiple
            // PIDs would collide and only differ by an opaque "_2", "_3" rotation.
            var outputFile = ResolveOutputFileName(inputFile, options, languageSuffix: $"dvb_pid{pid}", trackNumber: pid);

            if (!options.Quiet)
            {
                AnsiConsole.MarkupInterpolated($"[dim]{fileIndex}:[/] [cyan]{Path.GetFileName(inputFile)}[/] [yellow]PID {pid} [/][dim](DVB img→img)→[/] [green]{outputFile}[/]...");
            }

View on GitHub (pinned to 17a9f07487)

Solutions

  1. Remove --output-filename and let each PID auto-name with the dvb_pid{N} suffix.
  2. 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).
  3. Point --output-folder at a dedicated directory instead of fixing one filename.

Example fix

// before
seconv capture.ts dvbsub --output-filename out.sub
// after (auto-name per PID)
seconv capture.ts dvbsub --output-folder ./out
Defensive patterns

Strategy: validation

Validate before calling

// Pre-count DVB-sub PIDs before fixing the output name
var pids = BitmapSubtitleLoader.LoadTransportStreamDvbSub(inputFile);
if (!string.IsNullOrEmpty(options.OutputFilename) && pids.Count > 1)
    throw new ArgException("TS has " + pids.Count + " DVB PIDs; drop --output-filename or split the stream.");

Type guard

null

Try / catch

null

Prevention

When it happens

Trigger: PassThroughTransportStreamDvbAsync finds streams.Count > 1 from BitmapSubtitleLoader.LoadTransportStreamDvbSub, AND options.OutputFilename is non-empty, AND --teletext-only is not active.

Common situations: 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.

Related errors


AI-assisted analysis of SubtitleEdit/subtitleedit@17a9f07487 (2026-08-13). Data as JSON: /api/errors/4ca819f723d933de. Report an issue: GitHub.