remotion-dev/remotion · error

Unknown audio format: ${codec.format}

Error message

Unknown audio format: ${codec.format}

What it means

Thrown by getAudioCodecFromAudioCodecInfo when codec.format is not one of the formats handled by the parser (twos, in24, lpcm, sowt, ac-3, Opus, mp4a). It is the final fallthrough after every known format check fails, indicating an audio sample-entry format the library cannot map to a MediaParserAudioCodec.

Source

Thrown at packages/media-parser/src/get-audio-codec.ts:349

	}

	if (codec.format === 'mp4a') {
		if (codec.primarySpecificator === 0x40) {
			return 'aac';
		}

		if (codec.primarySpecificator === 0x6b) {
			return 'mp3';
		}

		if (codec.primarySpecificator === null) {
			return 'aac';
		}

		throw new Error('Unknown mp4a codec: ' + codec.primarySpecificator);
	}

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

export const getAudioCodecFromTrack = (track: TrakBox) => {
	const audioSample = getAudioCodecFromTrak(track);
	if (!audioSample) {
		throw new Error('Could not find audio sample');
	}

	return getAudioCodecFromAudioCodecInfo(audioSample);
};

View on GitHub (pinned to 78fe4bb3fd)

Solutions

  1. Transcode the source to a supported audio codec (AAC, MP3, PCM, Opus, AC-3) before parsing.
  2. Catch the error and surface a clear 'unsupported codec' message to the user; skip the track.
  3. Verify codec support with ffprobe first and skip unsupported files.

Example fix

// before
const codec = getAudioCodecFromTrack(trak);

// after
let codec;
try {
  codec = getAudioCodecFromTrack(trak);
} catch (err) {
  codec = null;
  console.warn('Unsupported audio format, skipping:', err.message);
}
Defensive patterns

Strategy: try-catch

Validate before calling

const knownFormats = ['twos','in24','lpcm','sowt','ac-3','Opus','mp4a'];
const info = getAudioCodecFromTrak(trak);
if (!info || !knownFormats.includes(info.format)) { /* unsupported */ }

Type guard

null

Try / catch

try { getAudioCodecFromAudioCodecInfo(info); } catch (e) { if (e.message.startsWith('Unknown audio format')) { /* skip */ } else throw e; }

Prevention

When it happens

Trigger: MP4 audio tracks using formats such as 'fLaC', 'alac', 'dtsc', 'samr', or any other FourCC outside the recognized set. Files produced by tools emitting uncommon sample-entry types.

Common situations: Processing heterogeneous user uploads (ALAC FLAC, AMR). Parsing files with newer codecs before the parser supports them. Encountering legacy formats from mobile recorders.

Related errors


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