{"record":{"id":"fbceac94c059c532","repo":"TeamNewPipe/NewPipe","slug":"unsupported-ebml-data-webm","errorCode":null,"errorMessage":"Unsupported EBML data (WebM)","messagePattern":"Unsupported EBML data \\(WebM\\)","errorType":"exception","errorClass":"UnsupportedOperationException","httpStatus":null,"severity":"error","filePath":"app/src/main/java/org/schabi/newpipe/streams/WebMReader.java","lineNumber":66,"sourceCode":"    public enum TrackKind {\n        Audio/*2*/, Video/*1*/, Other\n    }\n\n    private final DataReader stream;\n    private Segment segment;\n    private WebMTrack[] tracks;\n    private int selectedTrack;\n    private boolean done;\n    private boolean firstSegment;\n\n    public WebMReader(final SharpStream source) {\n        this.stream = new DataReader(source);\n    }\n\n    public void parse() throws IOException {\n        Element elem = readElement(ID_EMBL);\n        if (!readEbml(elem, 1, 2)) {\n            throw new UnsupportedOperationException(\"Unsupported EBML data (WebM)\");\n        }\n        ensure(elem);\n\n        elem = untilElement(null, ID_SEGMENT);\n        if (elem == null) {\n            throw new IOException(\"Fragment element not found\");\n        }\n        segment = readSegment(elem, 0, true);\n        tracks = segment.tracks;\n        selectedTrack = -1;\n        done = false;\n        firstSegment = true;\n    }\n\n    public WebMTrack[] getAvailableTracks() {\n        return tracks;\n    }\n","sourceCodeStart":48,"sourceCodeEnd":84,"githubUrl":"https://github.com/TeamNewPipe/NewPipe/blob/9e8be091560a69f35d44bd252eb00bc7911c977b/app/src/main/java/org/schabi/newpipe/streams/WebMReader.java#L48-L84","documentation":"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.","triggerScenarios":"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.","commonSituations":"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.","solutions":["Use a genuine WebM source (DocType 'webm', low DocTypeVersion) rather than a generic MKV.","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).","Pre-read the EBML header and confirm readVersion==1 and docTypeVersion<=2 before parsing.","If you must read modern MKV, use a full Matroska library instead of this lightweight reader."],"exampleFix":"// before — modern MKV trips the EBML version gate\nnew WebMReader(mkvStream).parse(); // UnsupportedOperationException\n\n// after — remux to WebM first\nffmpeg -i in.mkv -c:v libvpx-vp9 -c:a libopus -f webm out.webm\nnew WebMReader(webmStream).parse();","handlingStrategy":"validation","validationCode":"// Read the EBML header and check readVersion/docTypeVersion before parsing.\n// WebMReader does this internally via readEbml(elem, 1, 2); mirror it externally:\n// Easiest: validate the file is WebM and low DocTypeVersion with mkvinfo/ffprobe first.","typeGuard":"public static boolean isSupportedWebM(int readVersion, int docTypeVersion) {\n    return readVersion == 1 && docTypeVersion <= 2;\n}","tryCatchPattern":"try {\n    reader.parse();\n} catch (UnsupportedOperationException e) {\n    if (e.getMessage().contains(\"EBML\")) {\n        // unsupported version — re-mux to WebM or use a full Matroska library\n        remuxToWebM();\n    } else throw e;\n}","preventionTips":["Use genuine WebM sources, not modern MKV with high DocTypeVersion.","Re-mux with ffmpeg -f webm to lower the version.","Pre-check DocTypeVersion with mkvinfo before parsing.","For modern MKV, use a full Matroska library."],"tags":["webm","format-validation","version","ebml","java"],"backgroundTag":null,"analyzedSha":"9e8be091560a69f35d44bd252eb00bc7911c977b","analyzedAt":"2026-08-14T00:11:33.519Z","schemaVersion":2},"datasetVersion":"2026-08-14T00:17:13.853Z"}