remotion-dev/remotion · error · Error
No moov box found
Error message
No moov box found
What it means
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.
Source
Thrown at packages/media-parser/src/init-video.ts:34
const fileType = state.iterator.detectFileType();
const {mimeType, name, contentLength} = state;
if (fileType.type === 'riff') {
Log.verbose(state.logLevel, 'Detected RIFF container');
state.structure.setStructure({
type: 'riff',
boxes: [],
});
return;
}
if (state.m3uPlaylistContext?.mp4HeaderSegment) {
Log.verbose(state.logLevel, 'Detected ISO Base Media segment');
const moovAtom = getMoovFromFromIsoStructure(
state.m3uPlaylistContext.mp4HeaderSegment,
);
if (!moovAtom) {
throw new Error('No moov box found');
}
const tracks = getTracksFromMoovBox(moovAtom);
for (const track of tracks.filter((t) => t.type === 'video')) {
await registerVideoTrack({
track,
container: 'mp4',
logLevel: state.logLevel,
onVideoTrack: state.onVideoTrack,
registerVideoSampleCallback:
state.callbacks.registerVideoSampleCallback,
tracks: state.callbacks.tracks,
});
}
for (const track of tracks.filter((t) => t.type === 'audio')) {
await registerAudioTrack({
track,View on GitHub (pinned to 78fe4bb3fd)
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.
Example fix
// before
await parseMedia({src: 'https://cdn/broken/master.m3u8', fields: {durationInSeconds: true}});
// after: verify init segment first
// fetch the #EXT-X-MAP URI and confirm `ffprobe init.mp4` lists streams, then:
try {
await parseMedia({src: 'https://cdn/fixed/master.m3u8', fields: {durationInSeconds: true}});
} catch (e) {
if (e.message === 'No moov box found') throw new Error('HLS init segment is invalid');
throw e;
} Defensive patterns
Strategy: try-catch
Validate before calling
// Fetch the HLS init segment (#EXT-X-MAP URI) and verify it has a moov
import {execFileSync} from 'node:child_process';
function isValidHlsInit(initUrl: string): boolean {
try {
execFileSync('ffprobe', ['-v','error', initUrl], {stdio: 'pipe'});
return true;
} catch { return false; }
} Try / catch
try {
await parseMedia({src: hlsUrl, fields: {durationInSeconds: true}});
} catch (e) {
if (e instanceof Error && e.message === 'No moov box found') {
throw new Error(`HLS init segment is invalid for ${hlsUrl}`);
}
throw e;
} Prevention
- 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.
When it happens
Trigger: 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).
Common situations: 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.
Related errors
- No moov box found in header segment
- Expected an mp4 file
- Expected stsz box in trak box
- Expected stco box in trak box
- Expected stsc box in trak box
AI-assisted analysis of remotion-dev/remotion@78fe4bb3fd (2026-08-12).
Data as JSON: /api/errors/714aa464d13f41b9.
Report an issue: GitHub.