remotion-dev/remotion · error · TypeError
The "durationInFrames" prop ${component} must be an integer,
Error message
The "durationInFrames" prop ${component} must be an integer, but got ${durationInFrames}. What it means
`validateDurationInFrames` requires an integer duration when `allowFloats` is false. `<Composition>` resolves durations with `allowFloats:false`, so a fractional `durationInFrames` throws. Note `<Series.Sequence>` uses `allowFloats:true`, so this specific message primarily comes from `<Composition>`/config resolution.
Source
Thrown at packages/core/src/validation/validate-duration-in-frames.ts:26
const {allowFloats, component} = options;
if (typeof durationInFrames === 'undefined') {
throw new Error(`The "durationInFrames" prop ${component} is missing.`);
}
if (typeof durationInFrames !== 'number') {
throw new Error(
`The "durationInFrames" prop ${component} must be a number, but you passed a value of type ${typeof durationInFrames}`,
);
}
if (durationInFrames <= 0) {
throw new TypeError(
`The "durationInFrames" prop ${component} must be positive, but got ${durationInFrames}.`,
);
}
if (!allowFloats && durationInFrames % 1 !== 0) {
throw new TypeError(
`The "durationInFrames" prop ${component} must be an integer, but got ${durationInFrames}.`,
);
}
if (!Number.isFinite(durationInFrames)) {
throw new TypeError(
`The "durationInFrames" prop ${component} must be finite, but got ${durationInFrames}.`,
);
}
}
View on GitHub (pinned to 78fe4bb3fd)
Solutions
- Round to a whole frame: `Math.round(seconds * fps)`.
- Validate `Number.isInteger()` before assigning.
- Choose durations that divide evenly with fps.
Example fix
// before
const durationInFrames = seconds * fps; // e.g. 2.5 * 30 = 75 (ok), 1.1 * 30 = 33 (ok)... but 1.05*30=31.5 -> throws
<Composition durationInFrames={durationInFrames} ... />
// after
const durationInFrames = Math.round(seconds * fps);
<Composition durationInFrames={durationInFrames} ... /> Defensive patterns
Strategy: validation
Validate before calling
if (d % 1 !== 0) { throw new Error('duration must be an integer'); } Prevention
- Always Math.round(seconds * fps) when deriving duration.
- Validate Number.isInteger() for composition durations.
When it happens
Trigger: Passing a fractional `durationInFrames` (e.g. `1.5`, `100.25`) to a `<Composition>`, or returning a fractional duration from `calculateMetadata` for a composition.
Common situations: Computing duration from seconds × fps where the product is not a whole number (`Math.ceil(seconds * fps)` left unrounded, or `seconds * 30` yielding a float); an aspect/sample-rate derived duration.
Related errors
- The "${nameOfProp}" prop ${location} must be a number, but y
- The "${nameOfProp}" prop ${location} must be an integer, but
- The "durationInFrames" prop ${component} is missing.
- The "durationInFrames" prop ${component} must be a number, b
- The "durationInFrames" prop ${component} must be positive, b
AI-assisted analysis of remotion-dev/remotion@78fe4bb3fd (2026-08-12).
Data as JSON: /api/errors/4dbd3876a69504ad.
Report an issue: GitHub.