{"record":{"id":"714aa464d13f41b9","repo":"remotion-dev/remotion","slug":"no-moov-box-found-714aa4","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/init-video.ts","lineNumber":34,"sourceCode":"\tconst fileType = state.iterator.detectFileType();\n\tconst {mimeType, name, contentLength} = state;\n\n\tif (fileType.type === 'riff') {\n\t\tLog.verbose(state.logLevel, 'Detected RIFF container');\n\t\tstate.structure.setStructure({\n\t\t\ttype: 'riff',\n\t\t\tboxes: [],\n\t\t});\n\t\treturn;\n\t}\n\n\tif (state.m3uPlaylistContext?.mp4HeaderSegment) {\n\t\tLog.verbose(state.logLevel, 'Detected ISO Base Media segment');\n\t\tconst moovAtom = getMoovFromFromIsoStructure(\n\t\t\tstate.m3uPlaylistContext.mp4HeaderSegment,\n\t\t);\n\t\tif (!moovAtom) {\n\t\t\tthrow new Error('No moov box found');\n\t\t}\n\n\t\tconst tracks = getTracksFromMoovBox(moovAtom);\n\t\tfor (const track of tracks.filter((t) => t.type === 'video')) {\n\t\t\tawait registerVideoTrack({\n\t\t\t\ttrack,\n\t\t\t\tcontainer: 'mp4',\n\t\t\t\tlogLevel: state.logLevel,\n\t\t\t\tonVideoTrack: state.onVideoTrack,\n\t\t\t\tregisterVideoSampleCallback:\n\t\t\t\t\tstate.callbacks.registerVideoSampleCallback,\n\t\t\t\ttracks: state.callbacks.tracks,\n\t\t\t});\n\t\t}\n\n\t\tfor (const track of tracks.filter((t) => t.type === 'audio')) {\n\t\t\tawait registerAudioTrack({\n\t\t\t\ttrack,","sourceCodeStart":16,"sourceCodeEnd":52,"githubUrl":"https://github.com/remotion-dev/remotion/blob/78fe4bb3fdb5a2cd68724393d63cb223db333fa7/packages/media-parser/src/init-video.ts#L16-L52","documentation":"In init-video, when state.m3uPlaylistContext.mp4HeaderSegment is set (HLS fMP4 init segment detected), the parser calls getMoovFromFromIsoStructure on that header bytes. If no moov atom is found in the init segment, it throws. The moov box is what carries track definitions, so without it the video tracks cannot be registered.","triggerScenarios":"Playing an HLS stream whose #EXT-X-MAP init segment (mp4HeaderSegment) does not contain a moov atom — e.g. the init is actually a media segment, is corrupt, or the playlist pointed at a non-fMP4 init. Reached only on the ISO-BMFF branch of init-video (m3uPlaylistContext.mp4HeaderSegment truthy).","commonSituations":"Misconfigured HLS master/media playlist, a CDN serving a stale or wrong init segment, transcoding pipelines that emit moof-only segments without a proper init, or version skew where the server changed the segment format.","solutions":["Validate the HLS playlist and its #EXT-X-MAP URI: download the init segment and run `ffprobe` to confirm it contains a moov atom.","Re-generate the HLS assets (e.g. `ffmpeg -i in.mp4 -c copy -f hls -hls_time 6 out.m3u8`) so the init segment is valid fMP4.","If multiple variants exist, ensure selectM3uStream picks a variant whose init segment is well-formed.","Report at https://remotion.dev/report if the stream plays in other HLS players but fails here."],"exampleFix":"// before\nawait parseMedia({src: 'https://cdn/broken/master.m3u8', fields: {durationInSeconds: true}});\n\n// after: verify init segment first\n// fetch the #EXT-X-MAP URI and confirm `ffprobe init.mp4` lists streams, then:\ntry {\n  await parseMedia({src: 'https://cdn/fixed/master.m3u8', fields: {durationInSeconds: true}});\n} catch (e) {\n  if (e.message === 'No moov box found') throw new Error('HLS init segment is invalid');\n  throw e;\n}","handlingStrategy":"try-catch","validationCode":"// Fetch the HLS init segment (#EXT-X-MAP URI) and verify it has a moov\nimport {execFileSync} from 'node:child_process';\nfunction isValidHlsInit(initUrl: string): boolean {\n  try {\n    execFileSync('ffprobe', ['-v','error', initUrl], {stdio: 'pipe'});\n    return true;\n  } catch { return false; }\n}","typeGuard":null,"tryCatchPattern":"try {\n  await parseMedia({src: hlsUrl, fields: {durationInSeconds: true}});\n} catch (e) {\n  if (e instanceof Error && e.message === 'No moov box found') {\n    throw new Error(`HLS init segment is invalid for ${hlsUrl}`);\n  }\n  throw e;\n}","preventionTips":["Generate HLS with a mainstream tool (FFmpeg) so init segments contain a valid moov.","Validate playlists with hlsverify / ffprobe before exposing them to the parser.","Ensure selectM3uStream selects a variant whose init segment is well-formed.","Monitor CDN for stale or wrong init-segment responses."],"tags":["hls","m3u8","mp4","init-segment","media-parser"],"backgroundTag":null,"analyzedSha":"78fe4bb3fdb5a2cd68724393d63cb223db333fa7","analyzedAt":"2026-08-12T17:18:50.444Z","schemaVersion":2},"datasetVersion":"2026-08-12T23:17:12.415Z"}