{"record":{"id":"c6ac5315b6e67f58","repo":"remotion-dev/remotion","slug":"no-moov-box-found","errorCode":null,"errorMessage":"No moov box found","messagePattern":"No moov box found","errorType":"exception","errorClass":"Error","httpStatus":null,"severity":"error","filePath":"packages/media-parser/src/containers/iso-base-media/get-moov-atom.ts","lineNumber":134,"sourceCode":"\t\t\tonlyIfMdatAtomExpected: null,\n\t\t\tcontentLength: state.contentLength - endOfMdat,\n\t\t});\n\t\tif (box.type === 'box') {\n\t\t\tboxes.push(box.box);\n\t\t}\n\n\t\tif (iterator.counter.getOffset() + endOfMdat > state.contentLength) {\n\t\t\tthrow new Error('Read past end of file');\n\t\t}\n\n\t\tif (iterator.counter.getOffset() + endOfMdat === state.contentLength) {\n\t\t\tbreak;\n\t\t}\n\t}\n\n\tconst moov = boxes.find((b) => b.type === 'moov-box');\n\tif (!moov) {\n\t\tthrow new Error('No moov box found');\n\t}\n\n\tLog.verbose(\n\t\tstate.logLevel,\n\t\t`Finished fetching moov atom in ${Date.now() - start}ms`,\n\t);\n\n\treturn moov;\n};\n","sourceCodeStart":116,"sourceCodeEnd":144,"githubUrl":"https://github.com/remotion-dev/remotion/blob/78fe4bb3fdb5a2cd68724393d63cb223db333fa7/packages/media-parser/src/containers/iso-base-media/get-moov-atom.ts#L116-L144","documentation":"Thrown by getMoovAtom after fetching and parsing the tail of the file (from endOfMdat to contentLength) when none of the parsed top-level boxes is a moov-box. This means the second fetch did not contain the movie metadata — the file either has no moov at all (unplayable), or the fetch read the wrong byte range, or the response was empty/truncated.","triggerScenarios":"Reached in the second-fetch branch (no m3u8 header segment). After reading bytes [endOfMdat, contentLength) and walking top-level boxes, no 'moov-box' was found. Common when contentLength is wrong so the parser reads a window that does not include moov, when the server ignored the range request, or when the file genuinely lacks moov.","commonSituations":"Files where moov is not at the end (e.g. at the head with ftyp) but the parser still did a second fetch because the first pass did not see it. Truncated uploads missing moov entirely. CDN/range-request misbehavior returning the wrong slice. moov atom stripped by accident.","solutions":["Confirm the file actually contains a moov atom using `ffprobe` or `mp4info`.","Ensure your readerInterface correctly serves the requested byte range; test with curl: `curl -r <endOfMdat>-<contentLength> -o tail.bin <url>` and inspect.","If moov is missing, re-mux with `-movflags faststart` so moov sits at the head and no second fetch is needed.","Provide an accurate contentLength; an under-sized length will exclude moov from the fetched window."],"exampleFix":"// before\nawait parseMedia({ src: url });\n\n// after\n// Ensure moov is at the front so no second fetch is needed\n// On the authoring side:\n//   ffmpeg -i in.mp4 -c copy -movflags +faststart out.mp4\n// Then parse normally\nawait parseMedia({ src: `${url}?v=faststart` });","handlingStrategy":"validation","validationCode":"import {execFileSync} from 'node:child_process';\nfunction fileHasMoov(file: string): boolean {\n  try {\n    execFileSync('ffprobe', ['-v', 'error', '-show_format', file], {encoding: 'utf8'});\n    return true;\n  } catch { return false; }\n}","typeGuard":"import type {IsoBaseMediaBox} from './base-media-box';\nfunction boxesContainMoov(boxes: IsoBaseMediaBox[]): boolean {\n  return boxes.some((b) => b.type === 'moov-box');\n}","tryCatchPattern":"try {\n  await parseMedia({ src: url });\n} catch (err) {\n  if (/^No moov box found$/i.test(String(err?.message))) {\n    throw new Error('No moov atom in the file. Re-mux with ffmpeg -movflags faststart or confirm the byte range served.');\n  }\n  throw err;\n}","preventionTips":["Prefer faststart-encoded MP4s so moov is at the head and no second fetch is needed.","Verify range requests with curl: `curl -r <start>-<end> -o tail.bin <url>` and confirm moov is present.","Provide an accurate contentLength so the second fetch window actually contains moov.","Reject files ffprobe cannot read — they almost certainly lack a valid moov."],"tags":["mp4","isobmff","media-parser","moov","range-request","corrupt-file"],"backgroundTag":null,"analyzedSha":"78fe4bb3fdb5a2cd68724393d63cb223db333fa7","analyzedAt":"2026-08-12T17:18:50.444Z","schemaVersion":2},"datasetVersion":"2026-08-12T18:17:37.767Z"}