SubtitleEdit/subtitleedit · error · InvalidOperationException

VobSub MKV track #{track.TrackNumber} is compressed (content

Error message

VobSub MKV track #{track.TrackNumber} is compressed (content encoding 1), which isn't supported.

What it means

InvalidOperationException from LoadMatroskaVobSub: the selected MKV S_VOBSUB track has ContentEncodingType == 1, meaning its subpicture packets are compressed (typically zlib header-stripped, the MKV 'content compression' flag) and the loader does not decompress them. This is a hard unsupported-format rejection, not a transient error.

Source

Thrown at src/seconv/Core/BitmapSubtitleLoader.cs:183

        catch
        {
            // I/O race / permissions — let the text loader try rather than hard-failing here.
            return false;
        }
    }

    /// <summary>
    /// VobSub track inside an MKV (<c>S_VOBSUB</c>) → bitmap events. The subpicture packets
    /// live in the Matroska blocks; the per-pack timing comes from the block Start/End (not
    /// the SubPicture's own delay, which only applies to standalone <c>.sub</c>+<c>.idx</c>).
    /// Mirrors the desktop batch converter's <c>LoadVobSubFromMatroska</c>; the palette is
    /// left to <see cref="SubPicture"/>'s default, matching the GUI's OCR path.
    /// </summary>
    public static IReadOnlyList<BitmapSubtitleItem> LoadMatroskaVobSub(MatroskaFile matroska, MatroskaTrackInfo track)
    {
        if (track.ContentEncodingType == 1)
        {
            throw new InvalidOperationException(
                $"VobSub MKV track #{track.TrackNumber} is compressed (content encoding 1), which isn't supported.");
        }

        // The track's CodecPrivate holds the .idx text, including the CLUT palette. Without
        // it SubPicture.GetBitmap skips SetColor/SetContrast and renders normally-transparent
        // planes opaque (issue #12772) — same fix as LoadVobSub; mirrors the GUI MKV path.
        var codecPrivate = track.GetCodecPrivate();
        var palette = GetVobSubIdxPalette(codecPrivate);
        var (screenWidth, screenHeight) = GetVobSubIdxScreenSize(codecPrivate);

        var sub = matroska.GetSubtitle(track.TrackNumber, null);
        var packs = new List<VobSubMergedPack>(sub.Count);
        foreach (var p in sub)
        {
            packs.Add(new VobSubMergedPack(p.GetData(track), TimeSpan.FromMilliseconds(p.Start), 32, null)
            {
                EndTime = TimeSpan.FromMilliseconds(p.End),
                Palette = palette,

View on GitHub (pinned to 17a9f07487)

Solutions

  1. Re-mux the MKV without content compression: mkvmerge --no-subtitles ... then re-add, or mkvmerge with --compression track:n:none.
  2. Extract the VobSub track to .sub/.idx with mkvextract and use LoadVobSub on the extracted files (mkvextract writes them uncompressed).
  3. Use a different source that does not compress the VobSub track.

Example fix

// before
if (track.ContentEncodingType == 1)
    throw new InvalidOperationException($"VobSub MKV track #{track.TrackNumber} is compressed (content encoding 1), which isn't supported.");

// after — decompress zlib blocks inline so compressed tracks work
var sub = track.ContentEncodingType == 1
    ? matroska.GetSubtitle(track.TrackNumber, null).Select(ZlibDecompress).ToList()
    : matroska.GetSubtitle(track.TrackNumber, null);
Defensive patterns

Strategy: validation

Validate before calling

if (track.ContentEncodingType == 1)
    throw new InvalidOperationException($"VobSub track #{track.TrackNumber} is compressed. Re-mux with mkvmerge --compression {track.TrackNumber}:none, or extract via mkvextract.");

Type guard

static bool IsUncompressedVobSub(MatroskaTrackInfo t) =>
    string.Equals(t.CodecID, "S_VOBSUB", StringComparison.OrdinalIgnoreCase) && t.ContentEncodingType != 1;

Try / catch

null

Prevention

When it happens

Trigger: An MKV whose VobSub track was authored with content encoding 1 (compressed payloads). mkvtoolnix can set this; some rippers do. The loader reads raw blocks and would feed compressed bytes to SubPicture, so it refuses instead of producing garbage.

Common situations: Ripping a DVD to MKV with compression enabled; re-muxing tools that preserve the compression flag; legacy MKVs from older mkvtoolnix defaults.

Related errors


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