{"record":{"id":"975db84a9a712c49","repo":"remotion-dev/remotion","slug":"could-not-find-video-codec-975db8","errorCode":null,"errorMessage":"Could not find video codec","messagePattern":"Could not find video codec","errorType":"exception","errorClass":"Error","httpStatus":null,"severity":"error","filePath":"packages/media-parser/src/containers/iso-base-media/make-track.ts","lineNumber":140,"sourceCode":"\n\tconst sampleAspectRatio = getSampleAspectRatio(trakBox);\n\n\tconst aspectRatioApplied = applyAspectRatios({\n\t\tdimensions: videoSample,\n\t\tsampleAspectRatio,\n\t\tdisplayAspectRatio: getDisplayAspectRatio({\n\t\t\tsampleAspectRatio,\n\t\t\tnativeDimensions: videoSample,\n\t\t}),\n\t});\n\n\tconst {displayAspectHeight, displayAspectWidth, height, rotation, width} =\n\t\tapplyTkhdBox(aspectRatioApplied, tkhdBox);\n\n\tconst codec = getVideoCodecString(trakBox);\n\n\tif (!codec) {\n\t\tthrow new Error('Could not find video codec');\n\t}\n\n\tconst privateData = getVideoPrivateData(trakBox);\n\n\tconst advancedColor = getIsoBmColrConfig(trakBox) ?? {\n\t\tfullRange: null,\n\t\tmatrix: null,\n\t\tprimaries: null,\n\t\ttransfer: null,\n\t};\n\n\tconst track: MediaParserVideoTrack = {\n\t\tm3uStreamFormat: null,\n\t\ttype: 'video',\n\t\ttrackId: tkhdBox.trackId,\n\t\tdescription: videoDescriptors ?? undefined,\n\t\toriginalTimescale: timescaleAndDuration.timescale,\n\t\tcodec,","sourceCodeStart":122,"sourceCodeEnd":158,"githubUrl":"https://github.com/remotion-dev/remotion/blob/78fe4bb3fdb5a2cd68724393d63cb223db333fa7/packages/media-parser/src/containers/iso-base-media/make-track.ts#L122-L158","documentation":"Thrown by makeBaseMediaTrack() after dimensions are resolved. getVideoCodecString(trakBox) returned a falsy value, meaning the video FourCC in stsd is not mapped to a known WebCodecs codec string (e.g. avc1/hev1/vp08/av01). Since the codec string is needed to configure a VideoDecoder, the parser aborts.","triggerScenarios":"parseMedia({src}) on a video MP4/MOV whose stsd sample entry uses a FourCC the parser does not recognise or map, or where the stsd/codec-resolution code path returns null for another reason (e.g. missing avcC/hvcC/vpcC/av1C config box under a recognised FourCC).","commonSituations":"Files using rare or proprietary codecs (e.g. certain ProRes/DivX/Xvid/Cinepack-in-MP4 variants), newly added codecs the parser version predates, or files whose codec config sub-boxes were stripped.","solutions":["Transcode the video to a WebCodecs-supported codec: ffmpeg -i in.mp4 -c:v libx264 -crf 20 -pix_fmt yuv420p out.mp4 (H.264) or libvpx-vp9/libaom-av1.","Update @remotion/media-parser (or move to @remotion/mediabunny) — newer versions add codec mappings.","Run ffprobe <file> to identify the FourCC and confirm it is one WebCodecs supports.","If the codec is supported but the config box is missing, re-mux with ffmpeg -i in.mp4 -c:v copy out.mp4 to rebuild boxes."],"exampleFix":"// before\nconst {videoCodec} = await parseMedia({src, reader: nodeReader});\n\n// after\nlet videoCodec: string | null = null;\ntry {\n  ({videoCodec} = await parseMedia({src, reader: nodeReader}));\n} catch (err) {\n  if (err instanceof Error && /Could not find video codec/.test(err.message)) {\n    console.warn('Unrecognised video FourCC; transcode to H.264 with ffmpeg');\n    videoCodec = null;\n  } else throw err;\n}","handlingStrategy":"try-catch","validationCode":"// Confirm the video codec/FourCC is one WebCodecs supports before parsing:\n//   ffprobe -v error -select_streams v:0 -show_entries stream=codec_name -of default=nw=1:nk=1 in.mp4\nimport {execFileSync} from 'node:child_process';\nconst SUPPORTED = new Set(['h264','hevc','vp8','vp9','av1']);\nfunction videoCodecSupported(file: string): boolean {\n  try {\n    const codec = execFileSync('ffprobe',\n      ['-v','error','-select_streams','v:0','-show_entries','stream=codec_name','-of','default=nw=1:nk=1', file],\n      {encoding: 'utf8'}).trim();\n    return SUPPORTED.has(codec);\n  } catch { return false; }\n}","typeGuard":"// No structural guard: codec recognition happens deep inside the parser.\n// => typeGuard: null","tryCatchPattern":"let videoCodec: string | null = null;\ntry {\n  ({videoCodec} = await parseMedia({src, reader: nodeReader}));\n} catch (err) {\n  if (err instanceof Error && /Could not find video codec/.test(err.message)) {\n    videoCodec = null; // unsupported/unrecognised FourCC\n  } else {\n    throw err;\n  }\n}","preventionTips":["Transcode unsupported codecs to H.264/VP9/AV1 with ffmpeg before parsing.","Keep @remotion/media-parser (or Mediabunny) up to date for new codec mappings.","Pre-validate the codec with ffprobe.","Wrap parseMedia() in try/catch for heterogeneous inputs."],"tags":["mp4","iso-base-media","media-parser","video","corrupt-file","codec","fourcc","webcodecs"],"backgroundTag":null,"analyzedSha":"78fe4bb3fdb5a2cd68724393d63cb223db333fa7","analyzedAt":"2026-08-12T17:18:50.444Z","schemaVersion":2},"datasetVersion":"2026-08-12T18:17:37.767Z"}