remotion-dev/remotion · error

Only H264 is supported as a stream type in .avi, got ${handl

Error message

Only H264 is supported as a stream type in .avi, got ${handler}

What it means

Thrown by parseStrh() for a 'vids' stream when the handler FourCC (the 4 bytes after 'vids') is not exactly 'H264'. This is the stream-header-level guard that mirrors error 1389 in track construction. Any other video codec FourCC (XVID, DX50, MJPG, FMP4, etc.) trips it.

Source

Thrown at packages/media-parser/src/containers/riff/parse-strh.ts:23

export const parseStrh = ({
	iterator,
	size,
}: {
	iterator: BufferIterator;
	size: number;
}): RiffBox => {
	const box = iterator.startBox(size);
	const fccType = iterator.getByteString(4, false);
	if (fccType !== 'vids' && fccType !== 'auds') {
		throw new Error('Expected AVI handler to be vids / auds');
	}

	const handler =
		fccType === 'vids'
			? iterator.getByteString(4, false)
			: iterator.getUint32Le();
	if (typeof handler === 'string' && handler !== 'H264') {
		throw new Error(
			`Only H264 is supported as a stream type in .avi, got ${handler}`,
		);
	}

	if (fccType === 'auds' && handler !== 1) {
		throw new Error(
			`Only "1" is supported as a stream type in .avi, got ${handler}`,
		);
	}

	const flags = iterator.getUint32Le();
	const priority = iterator.getUint16Le();
	const language = iterator.getUint16Le();
	const initialFrames = iterator.getUint32Le();
	const scale = iterator.getUint32Le();
	const rate = iterator.getUint32Le();
	const start = iterator.getUint32Le();
	const length = iterator.getUint32Le();

View on GitHub (pinned to 78fe4bb3fd)

Solutions

  1. Transcode the video to H.264: ffmpeg -i in.avi -c:v libx264 -pix_fmt yuv420p -c:a aac out.avi
  2. If only audio is needed, drop the video stream.
  3. Pre-inspect with ffprobe -show_streams and reject non-H.264 AVIs before parsing.

Example fix

// before
await parseMediaStream({src: 'divx.avi'});

// after
// ffmpeg -i divx.avi -c:v libx264 -pix_fmt yuv420p -c:a aac out.avi
await parseMediaStream({src: 'out.avi'});
Defensive patterns

Strategy: validation

Validate before calling

// Pre-check the AVI video FourCC with ffprobe before parsing.
// ffprobe -v error -select_streams v -show_entries stream=codec_name -of csv in.avi
// Expect: h264

Type guard

function isH264FourCC(handler: string): boolean {
  return handler === 'H264';
}

Try / catch

try {
  await parseMediaStream({src: 'in.avi'});
} catch (err) {
  if (err instanceof Error && err.message.startsWith('Only H264 is supported')) {
    // transcode video to H.264: ffmpeg -i in.avi -c:v libx264 -pix_fmt yuv420p -c:a aac out.avi
  } else throw err;
}

Prevention

When it happens

Trigger: An AVI video stream with a non-H.264 codec FourCC. The handler is read as a 4-byte ASCII string for vids streams and compared to 'H264'.

Common situations: Legacy AVI files encoded with Xvid/DivX/MPEG-4 Part 2; Motion-JPEG AVIs from cameras; any modern re-encode that did not use H.264.

Related errors


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