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
- Re-encode with fixed block sizes: `ffmpeg -i input.flac output.flac` or `flac --force-raw-format --blocksize=4096 -o output.flac input.wav`.
- Switch to Mediabunny (https://www.remotion.dev/docs/mediabunny/metadata) which may handle variable block sizes.
- Report the file to the Remotion team — variable block size support may be a feature gap.
- 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
- Re-encode FLAC files with fixed block sizes if you control encoding.
- Check min/max block size with mediainfo or ffprobe for problematic files.
- Migrate to Mediabunny which may support variable block size FLAC.
- Use ffprobe as a fallback metadata extractor for variable-block-size FLAC files.
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
- Invalid block size
- Unexpected audio object type ${audioObjectType}
- Only supporting MPEG-4 for .aac
- Unsupported level: ${level.toString(16)}
- Invalid channel count: ${bits.toString(2)}
AI-assisted analysis of remotion-dev/remotion@78fe4bb3fd (2026-08-12).
Data as JSON: /api/errors/f90a5f479f93aac1.
Report an issue: GitHub.