{"record":{"id":"c76a1e38eaaf7759","repo":"remotion-dev/remotion","slug":"streaminfo-not-found","errorCode":null,"errorMessage":"Streaminfo not found","messagePattern":"Streaminfo not found","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"packages/media-parser/src/containers/flac/get-duration-from-flac.ts","lineNumber":8,"sourceCode":"import type {ParserState} from '../../state/parser-state';\n\nexport const getDurationFromFlac = (parserState: ParserState) => {\n\tconst structure = parserState.structure.getFlacStructure();\n\n\tconst streaminfo = structure.boxes.find((b) => b.type === 'flac-streaminfo');\n\tif (!streaminfo) {\n\t\tthrow new Error('Streaminfo not found');\n\t}\n\n\treturn streaminfo.totalSamples / streaminfo.sampleRate;\n};\n","sourceCodeStart":1,"sourceCodeEnd":13,"githubUrl":"https://github.com/remotion-dev/remotion/blob/78fe4bb3fdb5a2cd68724393d63cb223db333fa7/packages/media-parser/src/containers/flac/get-duration-from-flac.ts#L1-L13","documentation":"Thrown by getDurationFromFlac() when the FLAC structure has no box of type 'flac-streaminfo'. The STREAMINFO metadata block is mandatory in every valid FLAC file (RFC 9639) and contains the total sample count and sample rate needed to compute duration. Its absence means the file was not fully parsed, the STREAMINFO block is missing/corrupt, or the structure was not populated before duration was requested.","triggerScenarios":"Requesting duration from parseMedia on a FLAC file where the STREAMINFO metadata block was not found or stored during the initial header parse. This can occur with severely truncated files (missing the metadata header), files with a corrupt STREAMINFO block, or if the parser was invoked in a mode that skipped metadata parsing.","commonSituations":"Truncated FLAC files (e.g. incomplete downloads) missing the STREAMINFO block. Corrupt FLAC files where the 'fLaC' marker exists but the first metadata block is damaged. Files misidentified as FLAC that are actually another format.","solutions":["Verify the file is valid FLAC: `ffprobe input.flac` — if it fails, the file is corrupt.","Re-encode from a known-good source: `ffmpeg -i input.wav output.flac`.","Switch to Mediabunny (https://www.remotion.dev/docs/mediabunny/metadata).","If you call getDurationFromFlac directly, check structure.boxes for 'flac-streaminfo' before calling."],"exampleFix":"// before\nconst duration = getDurationFromFlac(parserState);\n\n// after (guard before calling)\nconst structure = parserState.structure.getFlacStructure();\nconst hasStreamInfo = structure.boxes.some((b) => b.type === 'flac-streaminfo');\nconst duration = hasStreamInfo ? getDurationFromFlac(parserState) : null;","handlingStrategy":"validation","validationCode":null,"typeGuard":null,"tryCatchPattern":"try {\n  const duration = await parseMedia({src, fields: {durationInSeconds: true}});\n} catch (e) {\n  if (e instanceof Error && e.message === 'Streaminfo not found') {\n    console.error('FLAC file missing STREAMINFO. Verify: ffprobe <file>. Re-encode: ffmpeg -i <file> out.flac');\n  } else {\n    throw e;\n  }\n}","preventionTips":["Validate FLAC files with ffprobe or flac -t before parsing.","Ensure files are fully downloaded (not truncated) before parsing.","Re-encode corrupt FLAC files from a known-good source.","Migrate to Mediabunny for more robust FLAC parsing."],"tags":["flac","media-parser","streaminfo","duration","missing-metadata"],"backgroundTag":null,"analyzedSha":"78fe4bb3fdb5a2cd68724393d63cb223db333fa7","analyzedAt":"2026-08-12T17:18:50.444Z","schemaVersion":2},"datasetVersion":"2026-08-14T00:17:13.853Z"}