TeamNewPipe/NewPipe · error · UnsupportedOperationException

Unsupported EBML data (WebM)

Error message

Unsupported EBML data (WebM)

What it means

WebMReader.parse() reads the EBML header element and calls readEbml(elem, 1, 2), requiring EBMLReadVersion == 1 and DocTypeVersion <= 2. If the file's EBML header is newer or otherwise unsupported, readEbml returns false and UnsupportedOperationException is thrown. The reader implements a constrained subset of the Matroska/WebM spec.

Source

Thrown at app/src/main/java/org/schabi/newpipe/streams/WebMReader.java:66

    public enum TrackKind {
        Audio/*2*/, Video/*1*/, Other
    }

    private final DataReader stream;
    private Segment segment;
    private WebMTrack[] tracks;
    private int selectedTrack;
    private boolean done;
    private boolean firstSegment;

    public WebMReader(final SharpStream source) {
        this.stream = new DataReader(source);
    }

    public void parse() throws IOException {
        Element elem = readElement(ID_EMBL);
        if (!readEbml(elem, 1, 2)) {
            throw new UnsupportedOperationException("Unsupported EBML data (WebM)");
        }
        ensure(elem);

        elem = untilElement(null, ID_SEGMENT);
        if (elem == null) {
            throw new IOException("Fragment element not found");
        }
        segment = readSegment(elem, 0, true);
        tracks = segment.tracks;
        selectedTrack = -1;
        done = false;
        firstSegment = true;
    }

    public WebMTrack[] getAvailableTracks() {
        return tracks;
    }

View on GitHub (pinned to 9e8be09156)

Solutions

  1. Use a genuine WebM source (DocType 'webm', low DocTypeVersion) rather than a generic MKV.
  2. Re-mux the file as WebM with ffmpeg: ffmpeg -i in.mkv -c copy -f webm out.webm (may fail if codecs aren't WebM-approved).
  3. Pre-read the EBML header and confirm readVersion==1 and docTypeVersion<=2 before parsing.
  4. If you must read modern MKV, use a full Matroska library instead of this lightweight reader.

Example fix

// before — modern MKV trips the EBML version gate
new WebMReader(mkvStream).parse(); // UnsupportedOperationException

// after — remux to WebM first
ffmpeg -i in.mkv -c:v libvpx-vp9 -c:a libopus -f webm out.webm
new WebMReader(webmStream).parse();
Defensive patterns

Strategy: validation

Validate before calling

// Read the EBML header and check readVersion/docTypeVersion before parsing.
// WebMReader does this internally via readEbml(elem, 1, 2); mirror it externally:
// Easiest: validate the file is WebM and low DocTypeVersion with mkvinfo/ffprobe first.

Type guard

public static boolean isSupportedWebM(int readVersion, int docTypeVersion) {
    return readVersion == 1 && docTypeVersion <= 2;
}

Try / catch

try {
    reader.parse();
} catch (UnsupportedOperationException e) {
    if (e.getMessage().contains("EBML")) {
        // unsupported version — re-mux to WebM or use a full Matroska library
        remuxToWebM();
    } else throw e;
}

Prevention

When it happens

Trigger: Parsing a WebM/Matroska file whose EBMLReadVersion is not 1 or whose DocTypeVersion exceeds 2. Modern MKV files (DocTypeVersion 4+) or non-WebM Matroska files trip this gate.

Common situations: Feeding a modern .mkv (higher DocTypeVersion) instead of a WebM; a file produced by a newer muxer using features beyond this reader's support; a Matroska file that is not strictly WebM.

Related errors


AI-assisted analysis of TeamNewPipe/NewPipe@9e8be09156 (2026-08-14). Data as JSON: /api/errors/fbceac94c059c532. Report an issue: GitHub.