{"record":{"id":"ad009f0b40dfd2e4","repo":"remotion-dev/remotion","slug":"the-primary-video-track-contains-no-presentable-de","errorCode":null,"errorMessage":"The primary video track contains no presentable decodable frames.","messagePattern":"The primary video track contains no presentable decodable frames\\.","errorType":"exception","errorClass":"Error","httpStatus":null,"severity":"error","filePath":"packages/video-matting/src/separate-video-layers.ts","lineNumber":398,"sourceCode":"\t\t\t\t};\n\n\t\t\t\toptions.signal?.addEventListener('abort', onAbort, {once: true});\n\n\t\t\t\ttry {\n\t\t\t\t\tconst canvasSink = new CanvasSink(videoTrack, {\n\t\t\t\t\t\talpha: true,\n\t\t\t\t\t\twidth,\n\t\t\t\t\t\theight,\n\t\t\t\t\t\tfit: 'fill',\n\t\t\t\t\t\tpoolSize: 1,\n\t\t\t\t\t});\n\t\t\t\t\titerator = canvasSink.canvases(\n\t\t\t\t\t\tvideoStartTimestamp,\n\t\t\t\t\t\tvideoEndTimestamp,\n\t\t\t\t\t);\n\t\t\t\t\tlet nextFrame = await iterator.next();\n\t\t\t\t\tif (nextFrame.done) {\n\t\t\t\t\t\tthrow new Error(\n\t\t\t\t\t\t\t'The primary video track contains no presentable decodable frames.',\n\t\t\t\t\t\t);\n\t\t\t\t\t}\n\n\t\t\t\t\tthrowIfAborted(options.signal);\n\n\t\t\t\t\tconst baseCanvas = createVideoMattingCanvas({width, height});\n\t\t\t\t\tconst foregroundCanvas = createVideoMattingCanvas({width, height});\n\t\t\t\t\tconst baseContext = getVideoMattingCanvasContext(baseCanvas);\n\t\t\t\t\tconst foregroundContext =\n\t\t\t\t\t\tgetVideoMattingCanvasContext(foregroundCanvas);\n\n\t\t\t\t\tbaseOutput = await createVideoLayerOutput({\n\t\t\t\t\t\tformat: new WebMOutputFormat(),\n\t\t\t\t\t\toptions: options.outputs?.base,\n\t\t\t\t\t});\n\t\t\t\t\tthrowIfAborted(options.signal);\n\t\t\t\t\tforegroundOutput = await createVideoLayerOutput({","sourceCodeStart":380,"sourceCodeEnd":416,"githubUrl":"https://github.com/remotion-dev/remotion/blob/b2f4e34732f3c6c222ea029413e22dc402218cd7/packages/video-matting/src/separate-video-layers.ts#L380-L416","documentation":"After configuring a CanvasSink over the video track, the first iterator.next() returned done — the track yielded no decodable, presentable frames in the [videoStartTimestamp, videoEndTimestamp] range. Even though the track metadata looked valid, no frame could actually be produced, so the library throws.","triggerScenarios":"A video whose packets all fail to decode (corrupt keyframes, unsupported profile found only at decode time), a track whose frames all lie outside the computed start/end timestamp window, or a container advertising frames that don't exist (truncated file).","commonSituations":"Truncated downloads missing the media data after moov; recordings where only metadata was written; files with unusual negative/offset timestamps so the sink window contains no samples; DRM-protected tracks that fail decode silently.","solutions":["Confirm the file plays fully in a video player; if it stalls at 0:00 the data is likely truncated — re-download or re-encode.","Re-encode with ffmpeg to regenerate valid frames: ffmpeg -i broken.mp4 -c:v libx264 -crf 20 fixed.mp4.","Check the source isn't DRM/encrypted (Encrypted Media Extensions content cannot be decoded by WebCodecs).","If timestamps are exotic, remux to normalize timestamps before processing."],"exampleFix":"// before\nawait separateVideoLayers({src: truncatedDownload});\n// after\nconst ok = await canDecodeFirstFrame(truncatedDownload); // your probe\nif (!ok) throw new Error('Source has no decodable frames');\nawait separateVideoLayers({src: truncatedDownload});","handlingStrategy":"validation","validationCode":"const input = new Input({source: new BlobSource(file), formats: ALL_FORMATS});\nconst track = await input.getPrimaryVideoTrack();\nif (!(await track.canDecode())) throw new Error('Track has no decodable frames');\n// also verify file completeness (e.g. expected size/checksum) before processing","typeGuard":null,"tryCatchPattern":"try {\n  await separateVideoLayers({src});\n} catch (e) {\n  if (e instanceof Error && e.message.includes('no presentable decodable frames')) {\n    const fixed = await reEncodeWithFfmpeg(src);\n    return separateVideoLayers({src: fixed});\n  }\n  throw e;\n}","preventionTips":["Verify uploads are complete (size/checksum) — truncated files often decode zero frames.","Reject DRM-protected content up front.","Test user files with a full-playback probe before batching processing."],"tags":["mediabunny","frames","decode","corrupt-file"],"backgroundTag":"empty-result-set","analyzedSha":"b2f4e34732f3c6c222ea029413e22dc402218cd7","analyzedAt":"2026-09-09T13:27:51.281Z","contentChangedAt":"2026-09-09T13:27:51.281Z","schemaVersion":2},"datasetVersion":"2026-09-14T05:17:10.506Z"}