remotion-dev/remotion · error

Unknown mp4a codec: ${codec.primarySpecificator}

Error message

Unknown mp4a codec: ${codec.primarySpecificator}

What it means

Thrown by getAudioCodecFromAudioCodecInfo when the audio format is 'mp4a' but primarySpecificator is a value other than 0x40 (AAC), 0x6b (MP3), or null (defaults to AAC). The library only maps those specificators to known codecs; any other objectTypeIndication is unsupported and surfaces as this error with the offending value.

Source

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

	if (codec.format === 'Opus') {
		return 'opus';
	}

	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. Re-encode the audio to a supported codec (AAC or MP3) with ffmpeg before parsing.
  2. Wrap the call in try/catch and report the unsupported specificator to the user, falling back to skipping the track.
  3. Check for an upstream update of @remotion/media-parser; new specificators may be added over time.

Example fix

// before
const codec = getAudioCodecFromTrack(trak);

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

Strategy: try-catch

Validate before calling

const info = getAudioCodecFromTrak(trak);
if (info && info.format === 'mp4a' && ![0x40, 0x6b, null].includes(info.primarySpecificator)) { /* unsupported subtype */ }

Type guard

null

Try / catch

try { getAudioCodecFromTrack(trak); } catch (e) { if (e.message.startsWith('Unknown mp4a codec')) { /* skip unsupported subtype */ } else throw e; }

Prevention

When it happens

Trigger: An MP4 audio track whose esds objectTypeIndication is an uncommon value (e.g. 0x66 for CELP, 0x67 for HVXC, 0x40 variants, alac-in-mp4a, etc.). Files using niche or legacy MPEG-4 audio object types.

Common situations: Parsing music libraries containing unusual codecs. Handling files from voice-recording hardware. Encountering object types not yet implemented by the parser.

Related errors


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