remotion-dev/remotion · error

Cannot determine timestamp

Error message

Cannot determine timestamp

What it means

Thrown by emitSample() during FLAC frame parsing when streamInfo.minimumBlockSize does not equal streamInfo.maximumBlockSize. The parser uses a fixed block size (maximumBlockSize) multiplied by the frame number to compute timestamps; if block sizes vary across frames (as indicated by differing min/max in STREAMINFO), this linear formula is invalid and the parser cannot determine the timestamp for a given frame number.

Source

Thrown at packages/media-parser/src/containers/flac/parse-flac-frame.ts:120

	});
	const parsed = parseFrameHeader({iterator, state});
	if (!parsed) {
		throw new Error('Invalid CRC');
	}

	const {blockSize, num, sampleRate} = parsed;

	const duration = blockSize / sampleRate;
	const structure = state.structure.getFlacStructure();
	const streamInfo = structure.boxes.find(
		(box) => box.type === 'flac-streaminfo',
	);
	if (!streamInfo) {
		throw new Error('Stream info not found');
	}

	if (streamInfo.minimumBlockSize !== streamInfo.maximumBlockSize) {
		throw new Error('Cannot determine timestamp');
	}

	const timestamp = (num * streamInfo.maximumBlockSize) / streamInfo.sampleRate;
	state.flac.audioSamples.addSample({
		timeInSeconds: timestamp,
		offset,
		durationInSeconds: duration,
	});

	const audioSample = convertAudioOrVideoSampleToWebCodecsTimestamps({
		sample: {
			data,
			duration,
			decodingTimestamp: timestamp,
			timestamp,
			type: 'key',
			offset,
		},

View on GitHub (pinned to 78fe4bb3fd)

Solutions

  1. Re-encode with fixed block sizes: `ffmpeg -i input.flac output.flac` or `flac --force-raw-format --blocksize=4096 -o output.flac input.wav`.
  2. Switch to Mediabunny (https://www.remotion.dev/docs/mediabunny/metadata) which may handle variable block sizes.
  3. Report the file to the Remotion team — variable block size support may be a feature gap.
  4. Use ffprobe for metadata extraction on these specific files.
Defensive patterns

Strategy: try-catch

Try / catch

try {
  const result = await parseMedia({src, fields: {durationInSeconds: true}});
} catch (e) {
  if (e instanceof Error && e.message === 'Cannot determine timestamp') {
    console.error('FLAC file uses variable block sizes. Re-encode with fixed blocks: ffmpeg -i input.flac output.flac');
  } else {
    throw e;
  }
}

Prevention

When it happens

Trigger: Parsing a FLAC file where the STREAMINFO block reports different minimum and maximum block sizes (i.e. variable-block-size encoding). The timestamp computation `(num * maximumBlockSize) / sampleRate` assumes a constant block size, which breaks for variable-block-size files.

Common situations: FLAC files encoded with variable block sizes per frame. This is valid per RFC 9639 but less common; many encoders use fixed block sizes. Files produced by encoders like 'flake' or certain libFLAC configurations that use variable block sizes. Some archival or professionally mastered FLAC files use this mode.

Related errors


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