TeamNewPipe/NewPipe · error · UnsupportedOperationException
file not recognized, failed to demux the audio stream
Error message
file not recognized, failed to demux the audio stream
What it means
Thrown by OggFromWebmDemuxer.test() after reading the first 4 bytes of the source stream and switching on the big-endian integer. 0x1a45dfa3 is the EBML/WebM/Matroska magic header; 0x4F676753 is 'OggS' (the Ogg container magic). If neither matches, the file is neither a WebM/MKV nor an Ogg container, so the demuxer cannot proceed. This is a format-detection guard before the actual WebM-to-Ogg conversion.
Source
Thrown at app/src/main/java/us/shandian/giga/postprocessing/OggFromWebmDemuxer.java:32
super(true, true, ALGORITHM_OGG_FROM_WEBM_DEMUXER);
}
@Override
boolean test(SharpStream... sources) throws IOException {
ByteBuffer buffer = ByteBuffer.allocate(4);
sources[0].read(buffer.array());
// youtube uses WebM as container, but the file extension (format suffix) is "*.opus"
// check if the file is a webm/mkv file before proceed
switch (buffer.getInt()) {
case 0x1a45dfa3:
return true;// webm/mkv
case 0x4F676753:
return false;// ogg
}
throw new UnsupportedOperationException("file not recognized, failed to demux the audio stream");
}
@Override
int process(SharpStream out, @NonNull SharpStream... sources) throws IOException {
OggFromWebMWriter demuxer = new OggFromWebMWriter(sources[0], out, streamInfo);
demuxer.parseSource();
demuxer.selectTrack(0);
demuxer.build();
return OK_RESULT;
}
}
View on GitHub (pinned to 9e8be09156)
Solutions
- Verify the source stream's actual container format before invoking this demuxer (check the MIME type or magic bytes upstream).
- Ensure the extractor selected a WebM/Opus audio stream, not an MP4/M4A one — check the format selection logic.
- If the source is already Ogg (.opus), skip this demuxer entirely (test() returns false for Ogg).
- Re-download the source if the first bytes are corrupt (compare against expected format magic).
Defensive patterns
Strategy: validation
Validate before calling
// Read and check magic bytes before invoking the demuxer:
ByteBuffer magic = ByteBuffer.allocate(4);
source.read(magic.array());
source.seek(0); // rewind
int sig = magic.getInt();
if (sig != 0x1a45dfa3 && sig != 0x4F676753) {
throw new IOException("Source is neither WebM nor Ogg (magic=0x" + Integer.toHexString(sig) + ")");
} Try / catch
try {
demuxer.test(sources);
} catch (UnsupportedOperationException e) {
if (e.getMessage() != null && e.getMessage().contains("file not recognized")) {
// wrong format selected — skip this postprocessor or pick a different stream
Log.w(TAG, "Source format not WebM/Ogg, skipping Ogg demux", e);
} else throw e;
} Prevention
- Match the postprocessor to the actual downloaded container format (check extractor's format info).
- Pre-validate magic bytes before invoking format-specific demuxers.
- If the source is already Ogg, skip the WebM-to-Ogg demuxer entirely.
When it happens
Trigger: OggFromWebmDemuxer.test(sources) reads sources[0] first 4 bytes; buffer.getInt() matches neither 0x1a45dfa3 nor 0x4F676753; the switch falls through to the throw. Happens when the downloaded audio source is a different container (MP4/AAC, MP3, raw), is corrupt at offset 0, or the wrong postprocessor was selected for the stream's actual format.
Common situations: YouTube served an MP4/M4A audio stream but the postprocessor pipeline assumed WebM/Opus; the source file was replaced or corrupted; extractor version mismatch selecting the wrong stream format; a partial download where the first 4 bytes are garbage.
Related errors
- cannot get the audio sample rate
- missing default frame time
- not implemented
- page size cannot be larger than 65025
- Truncated stream, missing {} bytes
AI-assisted analysis of TeamNewPipe/NewPipe@9e8be09156 (2026-08-14).
Data as JSON: /api/errors/72f7d171669cdebc.
Report an issue: GitHub.