{"record":{"id":"a1fb6c027c88e466","repo":"remotion-dev/remotion","slug":"expected-width-segment","errorCode":null,"errorMessage":"Expected width segment","messagePattern":"Expected width segment","errorType":"exception","errorClass":"Error","httpStatus":null,"severity":"error","filePath":"packages/media-parser/src/containers/webm/make-track.ts","lineNumber":282,"sourceCode":"\ttimescale,\n\ttrack,\n}: {\n\ttimescale: number;\n\ttrack: TrackEntry;\n}): MediaParserVideoTrack | MediaParserAudioTrack | null => {\n\tconst trackType = getTrackTypeSegment(track);\n\n\tif (!trackType) {\n\t\tthrow new Error('Expected track type segment');\n\t}\n\n\tconst trackId = getTrackId(track);\n\n\tif (trackTypeToString(trackType.value.value) === 'video') {\n\t\tconst width = getWidthSegment(track);\n\n\t\tif (width === null) {\n\t\t\tthrow new Error('Expected width segment');\n\t\t}\n\n\t\tconst height = getHeightSegment(track);\n\n\t\tif (height === null) {\n\t\t\tthrow new Error('Expected height segment');\n\t\t}\n\n\t\tconst displayHeight = getDisplayHeightSegment(track);\n\t\tconst displayWidth = getDisplayWidthSegment(track);\n\n\t\tconst codec = getCodecSegment(track);\n\t\tif (!codec) {\n\t\t\treturn null;\n\t\t}\n\n\t\tconst codecPrivate = getPrivateData(track);\n\t\tconst codecString = getMatroskaVideoCodecString({","sourceCodeStart":264,"sourceCodeEnd":300,"githubUrl":"https://github.com/remotion-dev/remotion/blob/78fe4bb3fdb5a2cd68724393d63cb223db333fa7/packages/media-parser/src/containers/webm/make-track.ts#L264-L300","documentation":"Thrown by `getTrack` (make-track.ts:282) for a video track whose TrackEntry has no `PixelWidth` element (`getWidthSegment` returns null). PixelWidth is mandatory for video tracks in Matroska; without it the coded/display width is unknown and the track object cannot be constructed.","triggerScenarios":"A video TrackEntry missing `PixelWidth`. Truncated/corrupt headers, non-conformant muxers, or files where the video element block was written before dimensions were finalized.","commonSituations":"Interrupted encodes; corrupt MKV/WebM video track headers; rare muxer bugs. Files that play elsewhere virtually always carry PixelWidth.","solutions":["Re-mux/re-encode so dimensions are recorded: `ffmpeg -i in.webm -c copy out.webm`.","Verify with `ffprobe` — missing PixelWidth typically breaks it too.","Reject the corrupt asset upstream; catch the parse error and degrade."],"exampleFix":null,"handlingStrategy":"try-catch","validationCode":"// Verify the video stream reports dimensions before parsing.\nimport { execFile } from 'node:child_process';\nimport { promisify } from 'node:util';\nconst exec = promisify(execFile);\nasync function hasDimensions(filePath) {\n  const { stdout } = await exec('ffprobe', ['-v', 'error', '-select_entries', 'stream=width,height', '-of', 'json', filePath]);\n  const info = JSON.parse(stdout);\n  return info.streams?.some((s) => s.width && s.height) ?? false;\n}","typeGuard":null,"tryCatchPattern":"try {\n  await parseMedia({ src, fields: { tracks: true } });\n} catch (err) {\n  if (err instanceof Error && err.message === 'Expected width segment') {\n    console.warn('Video TrackEntry missing PixelWidth — malformed file:', src);\n    return null;\n  }\n  throw err;\n}","preventionTips":["Probe video dimensions with ffprobe before parsing to catch malformed headers.","Re-mux/re-encode corrupt files so PixelWidth and PixelHeight are written.","Reject malformed assets upstream."],"tags":["media-parser","webm","matroska","malformed-input","video-track","dimensions"],"backgroundTag":null,"analyzedSha":"78fe4bb3fdb5a2cd68724393d63cb223db333fa7","analyzedAt":"2026-08-12T17:18:50.444Z","schemaVersion":2},"datasetVersion":"2026-08-12T18:17:37.767Z"}