TeamNewPipe/NewPipe · error · UnsupportedOperationException

page size cannot be larger than 65025

Error message

page size cannot be larger than 65025

What it means

OggFromWebMWriter.addPacketSegment(size) throws UnsupportedOperationException if size > 65025 (255*255). The Ogg page segment-table format caps a single logical packet's contribution at 65025 bytes (255 segments × 255 bytes). A WebM block larger than this cannot be represented as one Ogg packet segment run.

Source

Thrown at app/src/main/java/org/schabi/newpipe/streams/OggFromWebMWriter.java:452

    private void clearSegmentTable() {
        segmentTableNextTimestamp += TIME_SCALE_NS;
        packetFlag = FLAG_UNSET;
        segmentTableSize = 0;
    }

    private boolean addPacketSegment(final SimpleBlock block) {
        final long timestamp = block.absoluteTimeCodeNs + webmTrack.codecDelay;

        if (timestamp >= segmentTableNextTimestamp) {
            return false;
        }

        return addPacketSegment(block.dataSize);
    }

    private boolean addPacketSegment(final int size) {
        if (size > 65025) {
            throw new UnsupportedOperationException("page size cannot be larger than 65025");
        }

        int available = (segmentTable.length - segmentTableSize) * 255;
        final boolean extra = (size % 255) == 0;

        if (extra) {
            // add a zero byte entry in the table
            // required to indicate the sample size is multiple of 255
            available -= 255;
        }

        // check if possible add the segment, without overflow the table
        if (available < size) {
            return false; // not enough space on the page
        }

        for (int seg = size; seg > 0; seg -= 255) {
            segmentTable[segmentTableSize++] = (byte) Math.min(seg, 255);

View on GitHub (pinned to 9e8be09156)

Solutions

  1. Use an audio track (smaller blocks) — large video blocks routinely exceed the Ogg packet cap.
  2. If the source is video, choose a different output container that does not have the 65025 limit.
  3. Re-encode at a lower bitrate/shorter block duration so individual blocks stay under 65025 bytes.
  4. Split oversized blocks before muxing (requires custom pre-processing not provided by this writer).

Example fix

// before — video keyframes exceed the Ogg page-segment limit
writer.write(); // throws: dataSize > 65025

// after — use an audio-only track for Ogg output
reader.selectTrack(audioTrack);
writer.write();
Defensive patterns

Strategy: validation

Validate before calling

// Before writing, confirm the largest block does not exceed the Ogg page limit.
final int OGG_MAX_PACKET = 255 * 255; // 65025
// (inspect blocks during a pre-pass; if any block.dataSize > limit, abort or use audio)

Type guard

public static boolean blockWithinOggLimit(SimpleBlock block) {
    return block.dataSize <= 65025;
}

Try / catch

try {
    writer.write();
} catch (UnsupportedOperationException e) {
    if (e.getMessage().contains("65025")) {
        // block too large for Ogg — switch to an audio track or a different container
        selectAudioTrackOrDifferentContainer();
    } else throw e;
}

Prevention

When it happens

Trigger: A WebM SimpleBlock whose data exceeds 65025 bytes is passed to addPacketSegment(block)→addPacketSegment(block.dataSize). The segment-table math cannot encode the packet size, so the writer aborts.

Common situations: A high-bitrate video keyframe or a long audio block whose payload exceeds the Ogg page-segment limit; an unusual source with very large single blocks; the 65025-byte cap is an Ogg format constraint, not a bug.

Related errors


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