remotion-dev/remotion · error · Error
Expected size 4 for fact box, got ${size}
Error message
Expected size 4 for fact box, got ${size} What it means
The WAV 'fact' chunk is spec-defined to hold exactly one uint32 (numberOfSamplesPerChannel), i.e. 4 payload bytes. parseFact reads the chunk size and rejects anything other than 4 because the parser only models the canonical fact payload. A non-4 size indicates a malformed, extended, or corrupted fact chunk.
Source
Thrown at packages/media-parser/src/containers/wav/parse-fact.ts:13
import type {ParseResult} from '../../parse-result';
import type {ParserState} from '../../state/parser-state';
import type {WavFact} from './types';
export const parseFact = ({
state,
}: {
state: ParserState;
}): Promise<ParseResult> => {
const {iterator} = state;
const size = iterator.getUint32Le();
if (size !== 4) {
throw new Error(`Expected size 4 for fact box, got ${size}`);
}
const numberOfSamplesPerChannel = iterator.getUint32Le();
const factBox: WavFact = {
type: 'wav-fact',
numberOfSamplesPerChannel,
};
state.structure.getWavStructure().boxes.push(factBox);
return Promise.resolve(null);
};
View on GitHub (pinned to 78fe4bb3fd)
Solutions
- Inspect the fact chunk size in a hex editor or via ffprobe -show_format.
- Re-encode to a clean WAV: ffmpeg -i in.wav out.wav.
- Use Mediabunny for broader WAV compatibility.
- try/catch parseMedia() and treat the file as unsupported.
Example fix
# re-encode to a spec-clean WAV
ffmpeg -i in.wav -c:a pcm_s16le out.wav
// then handle failure gracefully
try { await parseMedia({ src: 'out.wav' }); } catch { /* unsupported */ } Defensive patterns
Strategy: try-catch
Validate before calling
// ffprobe check: a spec-clean fact chunk parses without warning // ffprobe -v warning in.wav (exit 0 + no warnings => fact chunk ok)
Try / catch
try {
await parseMedia({ src: 'in.wav' });
} catch (err) {
if (err instanceof Error && /fact box/i.test(err.message)) {
// non-standard fact chunk — re-encode or skip
} else throw err;
} Prevention
- Re-encode WAVs from untrusted sources with ffmpeg before parsing.
- Use Mediabunny for broader chunk tolerance.
- Treat parseMedia() as fallible and always wrap it.
When it happens
Trigger: parseMedia() on a WAV whose 'fact' chunk size field is not 4: a padded/extended fact chunk, a corrupted size word, or an encoder that emits a non-standard fact body.
Common situations: Non-compliant encoders; broadcast/DAW WAVs with extended fact data; hand-edited or partially-overwritten files; files passed through lossy conversion.
Related errors
- Expected data box
- Only supporting WAVE with 22 extra bytes, but got ${extraSiz
- Only supporting WAVE with PCM audio format, but got ${subFor
- Expected fmt box
- Unexpected sampling frequency index ${samplingFrequencyIndex
AI-assisted analysis of remotion-dev/remotion@78fe4bb3fd (2026-08-12).
Data as JSON: /api/errors/8414a86fcd5b4ca4.
Report an issue: GitHub.