{"record":{"id":"454f12d6997ace2d","repo":"TeamNewPipe/NewPipe","slug":"page-size-cannot-be-larger-than-65025","errorCode":null,"errorMessage":"page size cannot be larger than 65025","messagePattern":"page size cannot be larger than 65025","errorType":"exception","errorClass":"UnsupportedOperationException","httpStatus":null,"severity":"error","filePath":"app/src/main/java/org/schabi/newpipe/streams/OggFromWebMWriter.java","lineNumber":452,"sourceCode":"    private void clearSegmentTable() {\n        segmentTableNextTimestamp += TIME_SCALE_NS;\n        packetFlag = FLAG_UNSET;\n        segmentTableSize = 0;\n    }\n\n    private boolean addPacketSegment(final SimpleBlock block) {\n        final long timestamp = block.absoluteTimeCodeNs + webmTrack.codecDelay;\n\n        if (timestamp >= segmentTableNextTimestamp) {\n            return false;\n        }\n\n        return addPacketSegment(block.dataSize);\n    }\n\n    private boolean addPacketSegment(final int size) {\n        if (size > 65025) {\n            throw new UnsupportedOperationException(\"page size cannot be larger than 65025\");\n        }\n\n        int available = (segmentTable.length - segmentTableSize) * 255;\n        final boolean extra = (size % 255) == 0;\n\n        if (extra) {\n            // add a zero byte entry in the table\n            // required to indicate the sample size is multiple of 255\n            available -= 255;\n        }\n\n        // check if possible add the segment, without overflow the table\n        if (available < size) {\n            return false; // not enough space on the page\n        }\n\n        for (int seg = size; seg > 0; seg -= 255) {\n            segmentTable[segmentTableSize++] = (byte) Math.min(seg, 255);","sourceCodeStart":434,"sourceCodeEnd":470,"githubUrl":"https://github.com/TeamNewPipe/NewPipe/blob/9e8be091560a69f35d44bd252eb00bc7911c977b/app/src/main/java/org/schabi/newpipe/streams/OggFromWebMWriter.java#L434-L470","documentation":"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.","triggerScenarios":"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.","commonSituations":"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.","solutions":["Use an audio track (smaller blocks) — large video blocks routinely exceed the Ogg packet cap.","If the source is video, choose a different output container that does not have the 65025 limit.","Re-encode at a lower bitrate/shorter block duration so individual blocks stay under 65025 bytes.","Split oversized blocks before muxing (requires custom pre-processing not provided by this writer)."],"exampleFix":"// before — video keyframes exceed the Ogg page-segment limit\nwriter.write(); // throws: dataSize > 65025\n\n// after — use an audio-only track for Ogg output\nreader.selectTrack(audioTrack);\nwriter.write();","handlingStrategy":"validation","validationCode":"// Before writing, confirm the largest block does not exceed the Ogg page limit.\nfinal int OGG_MAX_PACKET = 255 * 255; // 65025\n// (inspect blocks during a pre-pass; if any block.dataSize > limit, abort or use audio)","typeGuard":"public static boolean blockWithinOggLimit(SimpleBlock block) {\n    return block.dataSize <= 65025;\n}","tryCatchPattern":"try {\n    writer.write();\n} catch (UnsupportedOperationException e) {\n    if (e.getMessage().contains(\"65025\")) {\n        // block too large for Ogg — switch to an audio track or a different container\n        selectAudioTrackOrDifferentContainer();\n    } else throw e;\n}","preventionTips":["Use audio tracks for Ogg output (blocks are small).","Avoid video-to-Ogg conversion; large keyframes exceed the limit.","Re-encode at lower bitrate/shorter block durations if video-to-Ogg is unavoidable.","Pre-scan block sizes against the 65025 limit before writing."],"tags":["ogg","format-limit","size-limit","webm","java"],"backgroundTag":null,"analyzedSha":"9e8be091560a69f35d44bd252eb00bc7911c977b","analyzedAt":"2026-08-14T00:11:33.519Z","schemaVersion":2},"datasetVersion":"2026-08-14T00:17:13.853Z"}