{"record":{"id":"0d6427b436e1ab04","repo":"remotion-dev/remotion","slug":"the-input-is-not-a-supported-media-file","errorCode":null,"errorMessage":"The input is not a supported media file.","messagePattern":"The input is not a supported media file\\.","errorType":"exception","errorClass":"Error","httpStatus":null,"severity":"error","filePath":"packages/video-matting/src/separate-video-layers.ts","lineNumber":253,"sourceCode":"\nconst makeInput = (src: string | URL | Blob): Input => {\n\tconst source =\n\t\ttypeof src === 'string' || src instanceof URL\n\t\t\t? new UrlSource(src)\n\t\t\t: new BlobSource(src);\n\n\treturn new Input({formats: ALL_FORMATS, source});\n};\n\nconst probeVideoInput = async ({\n\tinput,\n\tvideoQuality,\n}: {\n\tinput: Input;\n\tvideoQuality: Quality;\n}): Promise<{videoTrack: InputVideoTrack; width: number; height: number}> => {\n\tif (!(await input.canRead())) {\n\t\tthrow new Error('The input is not a supported media file.');\n\t}\n\n\tconst videoTrack = await input.getPrimaryVideoTrack();\n\tif (videoTrack === null) {\n\t\tthrow new Error('The input does not contain a video track.');\n\t}\n\n\tif (!(await videoTrack.canDecode())) {\n\t\tthrow new Error('The primary video track cannot be decoded.');\n\t}\n\n\tconst [width, height] = await Promise.all([\n\t\tvideoTrack.getDisplayWidth(),\n\t\tvideoTrack.getDisplayHeight(),\n\t]);\n\tif (\n\t\t!Number.isInteger(width) ||\n\t\twidth <= 0 ||","sourceCodeStart":235,"sourceCodeEnd":271,"githubUrl":"https://github.com/remotion-dev/remotion/blob/b2f4e34732f3c6c222ea029413e22dc402218cd7/packages/video-matting/src/separate-video-layers.ts#L235-L271","documentation":"Before decoding, separateVideoLayers wraps the input in a mediabunny Input and calls input.canRead(). If the source cannot be read as a supported media file (unrecognized/missing container or demuxer failure), this Error is thrown. It is the library's way of saying the src is not a media file mediabunny can demux (MP4/WebM etc.).","triggerScenarios":"Passing a src string/URL/Blob that is not a media file (HTML error page, JSON, missing file served with 200, empty Blob), or a URL that fails to fetch, or a format mediabunny does not support (e.g. AVI, MKV with unsupported profiles).","commonSituations":"Server returns an HTML 404 page with status 200; dev proxy misroutes the media request; user uploads a file with .mp4 extension that is actually something else; CORS-blocked fetch yielding an opaque empty response; pointing at a WebM that is actually an audio-only stream container that can't be read.","solutions":["Verify the URL/Blob resolves to a real, supported media file (open it in a browser tab or check Content-Type).","Confirm the server serves the file with correct status and Content-Type (video/mp4, video/webm) and CORS headers if cross-origin.","Check the file extension vs actual container with `file` (CLI) or the first bytes of the Blob.","Re-encode the source into MP4 (H.264) or WebM (VP9) if it is in an unsupported container/codec."],"exampleFix":"// before\nconst res = await separateVideoLayers({src: '/api/export?id=1'}); // returns HTML error page\n// after\nconst response = await fetch('/api/export?id=1');\nif (!response.headers.get('content-type')?.startsWith('video/')) {\n  throw new Error('Endpoint did not return a video file');\n}\nawait separateVideoLayers({src: response.url});","handlingStrategy":"validation","validationCode":"const input = new Input({source: new UrlSource(src), formats: ALL_FORMATS});\nif (!(await input.canRead())) {\n  throw new Error(`Source is not a supported media file: ${src}`);\n}","typeGuard":null,"tryCatchPattern":"try {\n  await separateVideoLayers({src});\n} catch (e) {\n  if (e instanceof Error && e.message.includes('not a supported media file')) {\n    showUserError('Please provide an MP4 or WebM video file.');\n  } else throw e;\n}","preventionTips":["Check Content-Type and HTTP status of media URLs before processing.","Accept files via <input accept=\"video/mp4,video/webm\"> to filter at selection time.","Validate the first bytes of a Blob (ftyp / EBML magic) before calling."],"tags":["mediabunny","input","unsupported-format","validation"],"backgroundTag":"incompatible-source-type","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"}