remotion-dev/remotion · error · Error

Expected height segment

Error message

Expected height segment

What it means

Thrown by `getTrack` (make-track.ts:288) for a video track whose TrackEntry has no `PixelHeight` element (`getHeightSegment` returns null). Sibling guard to 1458: PixelHeight is mandatory for video tracks and is required (along with PixelWidth and optional DisplayWidth/Height) to populate the track's coded and display dimensions.

Source

Thrown at packages/media-parser/src/containers/webm/make-track.ts:288

	const trackType = getTrackTypeSegment(track);

	if (!trackType) {
		throw new Error('Expected track type segment');
	}

	const trackId = getTrackId(track);

	if (trackTypeToString(trackType.value.value) === 'video') {
		const width = getWidthSegment(track);

		if (width === null) {
			throw new Error('Expected width segment');
		}

		const height = getHeightSegment(track);

		if (height === null) {
			throw new Error('Expected height segment');
		}

		const displayHeight = getDisplayHeightSegment(track);
		const displayWidth = getDisplayWidthSegment(track);

		const codec = getCodecSegment(track);
		if (!codec) {
			return null;
		}

		const codecPrivate = getPrivateData(track);
		const codecString = getMatroskaVideoCodecString({
			track,
			codecSegment: codec,
		});
		const colour = getColourSegment(track);

		if (!codecString) {

View on GitHub (pinned to 78fe4bb3fd)

Solutions

  1. Re-mux/re-encode with a conformant tool so both PixelWidth and PixelHeight are written: `ffmpeg -i in.webm -c copy out.webm`.
  2. Verify integrity with `ffprobe`; reject if it also fails.
  3. Catch the parse error and skip the asset.
Defensive patterns

Strategy: try-catch

Validate before calling

// Same dimension probe as 1458 — both width and height must be present.
import { execFile } from 'node:child_process';
import { promisify } from 'node:util';
const exec = promisify(execFile);
async function hasDimensions(filePath) {
  const { stdout } = await exec('ffprobe', ['-v', 'error', '-select_entries', 'stream=width,height', '-of', 'json', filePath]);
  const info = JSON.parse(stdout);
  return info.streams?.some((s) => s.width && s.height) ?? false;
}

Try / catch

try {
  await parseMedia({ src, fields: { tracks: true } });
} catch (err) {
  if (err instanceof Error && err.message === 'Expected height segment') {
    console.warn('Video TrackEntry missing PixelHeight — malformed file:', src);
    return null;
  }
  throw err;
}

Prevention

When it happens

Trigger: A video TrackEntry missing `PixelHeight`. Same root causes as 1458 — truncated/corrupt EBML headers or non-conformant muxers. Fires immediately after the PixelWidth check passes.

Common situations: Corrupt or partially written MKV/WebM video track headers; experimental muxer output; interrupted encodes.

Related errors


AI-assisted analysis of remotion-dev/remotion@78fe4bb3fd (2026-08-12). Data as JSON: /api/errors/33e8eb3b994d10ee. Report an issue: GitHub.