remotion-dev/remotion · error · Error
Expected vorbis private data version 2
Error message
Expected vorbis private data version 2
What it means
For a Vorbis track the Matroska CodecPrivate starts with a Xiph-lacing header whose first byte is packet-count-minus-1. Vorbis uses exactly 3 header packets (identification, comment, setup), so that count byte must be 2. getAudioDescription rejects any other value because the lacing model assumes three packets.
Source
Thrown at packages/media-parser/src/containers/webm/description.ts:21
import {getCodecSegment, getPrivateData} from './traversal';
export const getAudioDescription = (
track: TrackEntry,
): undefined | Uint8Array => {
const codec = getCodecSegment(track);
if (!codec || codec.value !== 'A_VORBIS') {
return undefined;
}
// how to parse vorbis private
// https://github.com/google/ExoPlayer/blob/dd430f7053a1a3958deea3ead6a0565150c06bfc/library/extractor/src/main/java/com/google/android/exoplayer2/extractor/mkv/MatroskaExtractor.java#L2466
const privateData = getPrivateData(track);
if (!privateData) {
return undefined;
}
if (privateData[0] !== 2) {
throw new Error('Expected vorbis private data version 2');
}
let offset = 1;
let vorbisInfoLength = 0;
let vorbisSkipLength = 0;
while ((privateData[offset] & 0xff) === 0xff) {
vorbisInfoLength += 0xff;
offset++;
}
vorbisInfoLength += privateData[offset++] & 0xff;
while ((privateData[offset] & 0xff) === 0xff) {
vorbisSkipLength += 0xff;
offset++;
}
View on GitHub (pinned to 78fe4bb3fd)
Solutions
- Re-encode the audio: ffmpeg -i in.webm -c:a libvorbis out.webm.
- Verify the Vorbis headers with ffprobe.
- Use Mediabunny; try/catch parseMedia().
Example fix
# re-encode Vorbis audio cleanly
ffmpeg -i in.webm -c:v copy -c:a libvorbis out.webm
await parseMedia({ src: 'out.webm' }); Defensive patterns
Strategy: try-catch
Validate before calling
// ffprobe confirms Vorbis headers are intact // ffprobe -v error -show_streams in.webm
Try / catch
try {
await parseMedia({ src: 'in.webm' });
} catch (err) {
if (err instanceof Error && /vorbis private data version 2/i.test(err.message)) {
// re-encode Vorbis or skip
} else throw err;
} Prevention
- Re-encode Vorbis audio with ffmpeg libvorbis for clean headers.
- Probe WebM files before parsing.
- Use Mediabunny for broader Vorbis packaging support.
When it happens
Trigger: A Vorbis track whose CodecPrivate[0] !== 2: wrong packet count, corrupted lacing byte, truncated CodecPrivate, or a non-Vorbis stream tagged A_VORBIS.
Common situations: Broken muxer output; truncated/corrupted CodecPrivate; legacy or non-standard Vorbis packaging.
Related errors
- Error parsing vorbis codec private
- Expected av1 private data to be version 1
- Expected av1 private data to be version 1, got ${version}
- Unexpected sampling frequency index ${samplingFrequencyIndex
- Could not find number of channels
AI-assisted analysis of remotion-dev/remotion@78fe4bb3fd (2026-08-12).
Data as JSON: /api/errors/4dad144eba175d7d.
Report an issue: GitHub.