remotion-dev/remotion · error

Unsupported video codec ${strh.handler}

Error message

Unsupported video codec ${strh.handler}

What it means

Thrown by makeAviVideoTrack() when an AVI video stream's strh.handler FourCC is not 'H264'. The parser only knows how to feed H.264 samples to WebCodecs, so any other video codec FourCC (XVID, DX50/DIVX, MJPG, MP42, etc.) is rejected.

Source

Thrown at packages/media-parser/src/containers/riff/get-tracks-from-avi.ts:67

		originalTimescale: MEDIA_PARSER_RIFF_TIMESCALE,
		trackId: index,
		startInSeconds: 0,
		timescale: WEBCODECS_TIMESCALE,
		trackMediaTimeOffsetInTrackTimescale: 0,
	};
};

export const makeAviVideoTrack = ({
	strh,
	strf,
	index,
}: {
	strh: StrhBox;
	strf: StrfBoxVideo;
	index: number;
}): MediaParserVideoTrack => {
	if (strh.handler !== 'H264') {
		throw new Error(`Unsupported video codec ${strh.handler}`);
	}

	return {
		codecData: null,
		codec: TO_BE_OVERRIDDEN_LATER,
		codecEnum: 'h264',
		codedHeight: strf.height,
		codedWidth: strf.width,
		width: strf.width,
		height: strf.height,
		type: 'video',
		displayAspectHeight: strf.height,
		originalTimescale: MEDIA_PARSER_RIFF_TIMESCALE,
		description: undefined,
		m3uStreamFormat: null,
		trackId: index,
		colorSpace: {
			fullRange: null,

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 you only need the audio, drop the video stream: ffmpeg -i in.avi -vn -c:a aac out.m4a and parse the audio instead.
  3. Pre-inspect codecs with ffprobe to filter unsupported files before parsing.

Example fix

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

// after
// ffmpeg -i xvid.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 codec FourCC via ffprobe before parsing.
// ffprobe -v error -select_streams v -show_entries stream=codec_name -of csv in.avi
// Expect: h264

Type guard

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

Try / catch

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

Prevention

When it happens

Trigger: Parsing an AVI whose video stream uses a non-H.264 codec: Xvid, DivX, Motion-JPEG, WMV, MPEG-4 Part 2 variants, etc. These are extremely common in older AVI files.

Common situations: Old DivX/Xvid movie rips, Motion-JPEG clips from cameras, screen-capture AVIs with custom codecs. Any AVI not produced by a modern H.264 encoder will hit this.

Related errors


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