remotion-dev/remotion · error · Error

Unknown audio format

Error message

Unknown audio format

What it means

Thrown by `getMatroskaAudioCodecEnum` (make-track.ts:173) for an `A_PCM/INT/LIT` track whose `AudioBitDepth` is present but not 8, 16, or 24. The enum mapping only knows those three PCM widths; any other value (e.g. 12, 32, 20) is unsupported.

Source

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

		const bitDepth = getBitDepth(track);
		if (bitDepth === null) {
			throw new Error('Expected bit depth');
		}

		if (bitDepth === 8) {
			return 'pcm-u8';
		}

		if (bitDepth === 16) {
			return 'pcm-s16';
		}

		if (bitDepth === 24) {
			return 'pcm-s24';
		}

		throw new Error('Unknown audio format');
	}

	if (codec.value === 'A_AAC') {
		return `aac`;
	}

	if (codec.value === 'A_MPEG/L3') {
		return 'mp3';
	}

	throw new Error(`Unknown codec: ${codec.value}`);
};

const getMatroskaAudioCodecString = (track: TrackEntry): string => {
	const codec = getCodecSegment(track);
	if (!codec) {
		throw new Error('Expected codec segment');
	}

View on GitHub (pinned to 78fe4bb3fd)

Solutions

  1. Down-convert to a supported depth: `ffmpeg -i in.mkv -c:a pcm_s16le out.mkv` (16-bit) or `pcm_s24le`.
  2. Report at https://remotion.dev/report if you need 32-bit PCM supported.
  3. Use a different container/codec (FLAC, WAV at 16/24-bit) for guaranteed parseability.
Defensive patterns

Strategy: validation

Validate before calling

// Confirm PCM bit depth is one of {8,16,24} before parsing.
import { execFile } from 'node:child_process';
import { promisify } from 'node:util';
const exec = promify(execFile);
const SUPPORTED_PCM = new Set([8, 16, 24]);
async function isSupportedPcm(filePath) {
  const { stdout } = await exec('ffprobe', ['-v', 'error', '-select_entries', 'stream=codec_name,bits_per_sample', '-of', 'json', filePath]);
  const info = JSON.parse(stdout);
  return info.streams?.every((s) => !/pcm/i.test(s.codec_name ?? '') || SUPPORTED_PCM.has(s.bits_per_sample ?? 0)) ?? true;
}

Try / catch

try {
  await parseMedia({ src, fields: { tracks: true } });
} catch (err) {
  if (err instanceof Error && err.message === 'Unknown audio format') {
    console.error('Unsupported PCM bit depth — down-convert to 16/24-bit.');
  }
  throw err;
}

Prevention

When it happens

Trigger: A PCM track with bit depth 32 (float or int), 12, 20, or any value outside {8,16,24}. 32-bit PCM is the most common real-world hit since high-res audio sometimes uses it.

Common situations: High-resolution audio (32-bit PCM); unusual bit depths from niche encoders; PCM/floating-point (`A_PCM/FLOAT/IEEE`) mislabelled as INT.

Related errors


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