remotion-dev/remotion · error · Error

Expected private data in AV1 track

Error message

Expected private data in AV1 track

What it means

Thrown by `getMatroskaVideoCodecString` (make-track.ts:125) for an AV1 (`V_AV1`) track whose TrackEntry has no `CodecPrivate` element. Unlike AVC (which can fall back to SPS derivation), AV1 strictly requires the OBU sequence header carried in CodecPrivate (`parseAv1PrivateData`), so its absence is fatal for codec-string construction.

Source

Thrown at packages/media-parser/src/containers/webm/make-track.ts:125

		return NO_CODEC_PRIVATE_SHOULD_BE_DERIVED_FROM_SPS;
	}

	if (codec.value === 'V_MPEGH/ISO/HEVC') {
		const priv = getPrivateData(track);
		const iterator = getArrayBufferIterator({
			initialData: priv as Uint8Array,
			maxBytes: (priv as Uint8Array).length,
			logLevel: 'error',
		});

		return 'hvc1.' + getHvc1CodecString(iterator);
	}

	if (codec.value === 'V_AV1') {
		const priv = getPrivateData(track);

		if (!priv) {
			throw new Error('Expected private data in AV1 track');
		}

		return parseAv1PrivateData(priv, null);
	}

	throw new Error(`Unknown codec: ${codec.value}`);
};

export const getMatroskaAudioCodecEnum = ({
	track,
}: {
	track: TrackEntry;
}): MediaParserAudioCodec => {
	const codec = getCodecSegment(track);
	if (!codec) {
		throw new Error('Expected codec segment');
	}

View on GitHub (pinned to 78fe4bb3fd)

Solutions

  1. Re-mux/re-encode with a conformant tool so CodecPrivate is written: `ffmpeg -i in.webm -c:v libaom-av1 out.mkv`.
  2. Verify with `ffprobe in.webm` — a healthy AV1 track reports `encoder` and stream info; missing extradata usually breaks ffprobe too.
  3. Catch the error and reject the asset upstream.
Defensive patterns

Strategy: validation

Validate before calling

// Probe AV1 tracks for extradata presence before parsing.
import { execFile } from 'node:child_process';
import { promisify } from 'node:util';
const exec = promisify(execFile);
async function av1HasExtradata(filePath) {
  const { stdout } = await exec('ffprobe', ['-v', 'error', '-select_entries', 'stream=codec_name', '-of', 'json', filePath]);
  const info = JSON.parse(stdout);
  return info.streams?.some((s) => s.codec_name === 'av1');
}

Try / catch

try {
  await parseMedia({ src, fields: { tracks: true } });
} catch (err) {
  if (err instanceof Error && err.message === 'Expected private data in AV1 track') {
    console.error('AV1 track is missing CodecPrivate — re-encode the file.');
  }
  throw err;
}

Prevention

When it happens

Trigger: An AV1 WebM/MKV track whose TrackEntry omits `CodecPrivate`. Happens with malformed muxers, incomplete encodes, or files truncated mid-TrackEntry. Fires during the tracks resolution pass of `parseMedia()`.

Common situations: Files produced by buggy AV1 encoders/muxers; AV1 streams muxed without the AV1CodecConfigurationRecord-style OBU; interrupted encodes that wrote the track header before the sequence header was known.

Related errors


AI-assisted analysis of remotion-dev/remotion@78fe4bb3fd (2026-08-12). Data as JSON: /api/errors/cd511fc8dc00c6fe. Report an issue: GitHub.