remotion-dev/remotion · error · TypeError
videoEndTimestamp must be a finite number.
Error message
videoEndTimestamp must be a finite number.
What it means
prepareAudio validates the audio-transcoding timestamp window before processing: videoEndTimestamp must be a finite number (a parallel check already covered videoStartTimestamp). NaN, Infinity, or a non-numeric end timestamp aborts audio preparation with a TypeError.
Source
Thrown at packages/video-matting/src/prepare-audio.ts:64
videoEndTimestamp,
audioQuality,
forceTranscode,
}: {
input: Input;
baseOutput: Output<WebMOutputFormat, BaseTarget>;
foregroundOutput: Output<WebMOutputFormat, ForegroundTarget>;
destination: VideoMattingAudioDestination;
videoStartTimestamp: number;
videoEndTimestamp: number;
audioQuality: Quality | null;
forceTranscode: boolean;
}): Promise<PreparedVideoMattingAudio> => {
if (!Number.isFinite(videoStartTimestamp)) {
throw new TypeError('videoStartTimestamp must be a finite number.');
}
if (!Number.isFinite(videoEndTimestamp)) {
throw new TypeError('videoEndTimestamp must be a finite number.');
}
if (videoEndTimestamp < videoStartTimestamp) {
throw new RangeError(
'videoEndTimestamp must be greater than or equal to videoStartTimestamp.',
);
}
if (typeof forceTranscode !== 'boolean') {
throw new TypeError('forceTranscode must be a boolean.');
}
if (destination === 'none') {
return {
prime: () => Promise.resolve(),
writeAudioUntil: () => Promise.resolve(),
finishAudio: () => Promise.resolve(),
cancel: () => Promise.resolve(),View on GitHub (pinned to b2f4e34732)
Solutions
- Fall back to a finite duration (e.g. the asset's known duration) when metadata is missing
- Validate with Number.isFinite(videoEndTimestamp) before calling prepareAudio
- Fix parsing of config values so they produce numbers, not NaN
Example fix
// before const end = parseFloat(config.endTime); // NaN // after const end = Number.isFinite(parseFloat(config.endTime)) ? parseFloat(config.endTime) : duration;
Defensive patterns
Strategy: validation
Validate before calling
if (!Number.isFinite(videoEndTimestamp)) {
throw new TypeError('videoEndTimestamp must be finite before calling prepareAudio');
}
Type guard
const isFiniteNumber = (v: unknown): v is number => typeof v === 'number' && Number.isFinite(v);
Try / catch
try {
await prepareAudio({videoEndTimestamp, ...});
} catch (e) {
if (e instanceof TypeError && e.message.includes('videoEndTimestamp')) {
videoEndTimestamp = knownDuration;
}
throw e;
}
Prevention
- Replace unknown durations with a finite fallback instead of Infinity
- Parse config values with strict number validation
- Keep timestamps in a consistent unit
When it happens
Trigger: Passing NaN/Infinity/-Infinity as videoEndTimestamp, often derived from undefined durations, failed parses, or infinite loop bounds.
Common situations: Video duration metadata unavailable (unknown-length video) leaving Infinity; parseFloat on a malformed config value; arithmetic with null.
Understand the failure class
Background: "Must be a positive integer", "Invalid value", "Unsupported": the invalid-argument-value error family, when a library rejects the value you pass — this error's family across 35 libraries.
Related errors
- videoStartTimestamp must be a finite number.
- Argument passed to "${api}" for param "${param}" is ${JSON.s
- Invalid timestamp:${time}
- Threshold is NaN
- Frame ${frame} is not finite
AI-assisted analysis of remotion-dev/remotion@b2f4e34732 (2026-09-09).
Data as JSON: /api/errors/72e79e8e608331ae.
Report an issue: GitHub.