{"record":{"id":"a8999e351ca7a376","repo":"remotion-dev/remotion","slug":"expected-av1-private-data-to-be-version-1","errorCode":null,"errorMessage":"Expected av1 private data to be version 1","messagePattern":"Expected av1 private data to be version 1","errorType":"exception","errorClass":"Error","httpStatus":null,"severity":"error","filePath":"packages/media-parser/src/containers/webm/av1-codec-private.ts","lineNumber":16,"sourceCode":"import {getArrayBufferIterator} from '../../iterator/buffer-iterator';\nimport type {ColorParameterBox} from '../iso-base-media/stsd/colr';\n\nexport const parseAv1PrivateData = (\n\tdata: Uint8Array,\n\tcolrAtom: ColorParameterBox | null,\n) => {\n\tconst iterator = getArrayBufferIterator({\n\t\tinitialData: data,\n\t\tmaxBytes: data.byteLength,\n\t\tlogLevel: 'error',\n\t});\n\titerator.startReadingBits();\n\tif (iterator.getBits(1) !== 1) {\n\t\titerator.destroy();\n\t\tthrow new Error('Expected av1 private data to be version 1');\n\t}\n\n\tconst version = iterator.getBits(7);\n\tif (version !== 1) {\n\t\titerator.destroy();\n\t\tthrow new Error(\n\t\t\t`Expected av1 private data to be version 1, got ${version}`,\n\t\t);\n\t}\n\n\tlet str = 'av01.';\n\n\t// https://aomediacodec.github.io/av1-isobmff/#codecsparam\n\n\tconst seqProfile = iterator.getBits(3);\n\t// Profile\n\tstr += seqProfile;\n\tstr += '.';","sourceCodeStart":1,"sourceCodeEnd":34,"githubUrl":"https://github.com/remotion-dev/remotion/blob/78fe4bb3fdb5a2cd68724393d63cb223db333fa7/packages/media-parser/src/containers/webm/av1-codec-private.ts#L1-L34","documentation":"AV1 codec-private data (per AV1-in-ISOBMFF) must start with a 1-bit marker equal to 1. parseAv1PrivateData reads that first bit and throws if it isn't 1, i.e. the buffer is not valid AV1 codec-private data. This runs when a WebM/Matroska A_AV1 track is being resolved into a codec string.","triggerScenarios":"A WebM/Matroska AV1 track whose CodecPrivate does not begin with the AV1 marker bit: empty/missing CodecPrivate, a non-AV1 stream mislabeled A_AV1, or a corrupted CodecPrivate.","commonSituations":"Malformed MKV/WebM from a broken muxer; AV1 track missing its sequence-header OBU; file corruption.","solutions":["Re-mux or re-encode the AV1 track: ffmpeg -i in.mkv -c:v libaom-av1 out.mkv.","Confirm via ffprobe that the AV1 stream has valid headers.","Use Mediabunny; try/catch parseMedia()."],"exampleFix":"# re-mux AV1 into a clean Matroska\nffmpeg -i in.mkv -c copy out.mkv\n\nawait parseMedia({ src: 'out.mkv' });","handlingStrategy":"try-catch","validationCode":"// ffprobe confirms the AV1 stream has valid headers\n// ffprobe -v error -show_streams in.mkv","typeGuard":null,"tryCatchPattern":"try {\n  await parseMedia({ src: 'in.mkv' });\n} catch (err) {\n  if (err instanceof Error && /av1 private data/i.test(err.message)) {\n    // re-mux the AV1 track or skip\n  } else throw err;\n}","preventionTips":["Re-mux AV1 tracks with a current ffmpeg before parsing.","Validate MKV/WebM with ffprobe first.","Use Mediabunny for broader AV1 packaging support."],"tags":["webm","matroska","media-parser","av1","corrupt-file","codec"],"backgroundTag":null,"analyzedSha":"78fe4bb3fdb5a2cd68724393d63cb223db333fa7","analyzedAt":"2026-08-12T17:18:50.444Z","schemaVersion":2},"datasetVersion":"2026-08-12T18:17:37.767Z"}