{"record":{"id":"bcab373590293894","repo":"remotion-dev/remotion","slug":"no-tracks-found","errorCode":null,"errorMessage":"No tracks found","messagePattern":"No tracks found","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"packages/media-parser/src/get-tracks.ts","lineNumber":261,"sourceCode":"\tconst moovBox = getMoovBoxFromState({\n\t\tstructureState: structure,\n\t\tisoState,\n\t\tmp4HeaderSegment: m3uPlaylistContext?.mp4HeaderSegment ?? null,\n\t\tmayUsePrecomputed,\n\t});\n\tif (!moovBox) {\n\t\treturn [];\n\t}\n\n\treturn getTracksFromMoovBox(moovBox);\n};\n\nexport const defaultGetTracks = (\n\tparserState: ParserState,\n): MediaParserTrack[] => {\n\tconst tracks = parserState.callbacks.tracks.getTracks();\n\tif (tracks.length === 0) {\n\t\tthrow new Error('No tracks found');\n\t}\n\n\treturn tracks;\n};\n\nexport const defaultHasallTracks = (parserState: ParserState): boolean => {\n\ttry {\n\t\tdefaultGetTracks(parserState);\n\t\treturn true;\n\t} catch {\n\t\treturn false;\n\t}\n};\n\nexport const getTracks = (\n\tstate: ParserState,\n\tmayUsePrecomputed: boolean,\n): MediaParserTrack[] => {","sourceCodeStart":243,"sourceCodeEnd":279,"githubUrl":"https://github.com/remotion-dev/remotion/blob/78fe4bb3fdb5a2cd68724393d63cb223db333fa7/packages/media-parser/src/get-tracks.ts#L243-L279","documentation":"defaultGetTracks throws when the parser's track store (parserState.callbacks.tracks.getTracks()) is empty at the moment tracks are required. It is the consumer-facing signal that parsing completed (or was queried) but zero audio/video tracks could be extracted from the container. Note defaultHasallTracks calls defaultGetTracks inside try/catch and merely returns false, so the throw only surfaces when the result is actually demanded.","triggerScenarios":"Calling parseMedia (or any field that requires tracks) on a container the parser finished scanning without registering any track: e.g. a WebM/Matroska with no audio/video, an MP4 whose trak boxes all failed makeBaseMediaTrack, or a stream that ended before any track header arrived. Also triggered if hasAllTracks is false and code still demands getTracks().","commonSituations":"Passing a non-media file (e.g. a .txt renamed .mp4), a metadata-only MP4, an HLS playlist whose init segment lacks tracks, or a media file using an unsupported codec that makeBaseMediaTrack skips.","solutions":["Confirm the src is a real media file with at least one decodable track (`ffprobe src`).","Check the container/codec is supported by @remotion/media-parser; re-encode to H.264/AAC if unsure.","If querying fields conditionally, only request track-dependent fields after verifying the container has tracks.","Wrap parseMedia in try/catch and treat 'No tracks found' as a user-facing 'unsupported file' result rather than a crash."],"exampleFix":"// before\nconst {tracks} = await parseMedia({src, fields: {tracks: true}});\n\n// after\nlet tracks;\ntry {\n  ({tracks} = await parseMedia({src, fields: {tracks: true}}));\n} catch (e) {\n  if (e.message === 'No tracks found') tracks = [];\n  else throw e;\n}\nif (tracks.length === 0) console.warn('Unsupported or empty media:', src);","handlingStrategy":"try-catch","validationCode":"// Probe track count with ffprobe before parsing\nimport {execFileSync} from 'node:child_process';\nfunction hasTracks(path: string): boolean {\n  try {\n    const out = execFileSync('ffprobe', ['-v','error','-show_entries','stream=codec_type','-of','csv=p=0', path], {stdio: 'pipe'}).toString();\n    return out.trim().length > 0;\n  } catch { return false; }\n}","typeGuard":null,"tryCatchPattern":"let tracks = [];\ntry {\n  ({tracks} = await parseMedia({src, fields: {tracks: true}}));\n} catch (e) {\n  if (e instanceof Error && e.message === 'No tracks found') tracks = [];\n  else throw e;\n}\nif (tracks.length === 0) console.warn('No usable tracks in', src);","preventionTips":["Treat 'No tracks found' as an expected unsupported-file outcome, not a crash.","Pre-screen uploads with ffprobe to ensure at least one audio or video stream.","Re-encode exotic codecs to H.264/AAC before parsing.","Only request track-dependent fields when you know the container is supported."],"tags":["media-parser","no-tracks","unsupported-codec","validation"],"backgroundTag":null,"analyzedSha":"78fe4bb3fdb5a2cd68724393d63cb223db333fa7","analyzedAt":"2026-08-12T17:18:50.444Z","schemaVersion":2},"datasetVersion":"2026-08-12T18:17:37.767Z"}