remotion-dev/remotion · error · Error
Audio track cannot be decoded
Error message
Audio track cannot be decoded
What it means
Thrown inside useWindowedAudioData() when mediabunny reports audioTrack.canDecode() === false (line 150-154). The container has an audio track but the codec/sample-format is not decodable in the current environment, so windowing waveforms is impossible. Forwarded to cancelRender().
Source
Thrown at packages/media-utils/src/use-windowed-audio-data.ts:153
if (await audioTrack.isLive()) {
throw new Error(
'Live streams are not currently supported by Remotion. Sorry! Source: ' +
src,
);
}
if (await audioTrack.isRelativeToUnixEpoch()) {
throw new Error(
'Streams with UNIX timestamps are not currently supported by Remotion. Sorry! Source: ' +
src,
);
}
const canDecode = await audioTrack.canDecode();
if (!canDecode) {
throw new Error('Audio track cannot be decoded');
}
if (channelIndex >= audioTrack.numberOfChannels || channelIndex < 0) {
throw new Error(
`Invalid channel index ${channelIndex} for audio with ${audioTrack.numberOfChannels} channels`,
);
}
const numberOfChannels = await audioTrack.getNumberOfChannels();
const sampleRate = await audioTrack.getSampleRate();
const format = await input.getFormat();
const isMatroska = format === MATROSKA || format === WEBM;
if (isMounted.current) {
setAudioUtils({
input,View on GitHub (pinned to 78fe4bb3fd)
Solutions
- Transcode the audio to a widely supported codec: ffmpeg -i in.mp4 -c:v copy -c:a aac -b:a 192k out.mp4.
- If you need Opus, keep it in a WebM/Matroska container rather than MP4 for broader decoder support.
- Verify with ffprobe that the audio codec is one Chromium decodes (AAC, MP3, Opus-in-WebM, FLAC, Vorbis, WAV/PCM).
- Re-download the asset if you suspect truncation (compare file size to the source).
Example fix
// before (AC-3 audio Chromium cannot decode -> 'Audio track cannot be decoded')
useWindowedAudioData({src: staticFile('capture-ac3.mkv'), ...});
// after (re-encode audio to AAC)
// ffmpeg -i capture-ac3.mkv -c:v copy -c:a aac -b:a 192k capture-aac.mp4
useWindowedAudioData({src: staticFile('capture-aac.mp4'), ...}); Defensive patterns
Strategy: validation
Validate before calling
// Probe audio codec and reject ones Chromium does not decode
import {execFileSync} from 'child_process';
const SUPPORTED = new Set(['aac', 'mp3', 'opus', 'vorbis', 'flac', 'pcm_s16le', 'pcm_s24le']);
function isDecodableAudio(file: string): boolean {
const codec = execFileSync('ffprobe', ['-v', 'error', '-select_streams', 'a:0', '-show_entries', 'stream=codec_name', '-of', 'csv=p=0', file], {encoding: 'utf8'}).trim();
return SUPPORTED.has(codec);
}
if (!isDecodableAudio(file)) {
// re-encode to AAC before rendering
} Type guard
async function canDecodeMediabunny(src: string): Promise<boolean> {
const {Input} = await import('mediabunny');
const input = new Input({source: src});
try {
const track = await input.getPrimaryAudioTrack();
return track ? await track.canDecode() : false;
} finally {
input.dispose();
}
} Try / catch
// Forwarded to cancelRender(); wrap an ErrorBoundary and fall back to a re-encoded asset:
// <ErrorBoundary fallback={<Waveform src={staticFile('audio-aac.mp4')} ... />}>
// <WindowedWaveform src={src} ... />
// </ErrorBoundary> Prevention
- Prefer AAC or MP3 for audio inside Remotion assets.
- If you must use Opus, keep it inside a WebM/Matroska container rather than MP4.
- Run ffprobe -show_entries stream=codec_name on new assets before wiring them in.
- Re-download truncated assets if decoder setup fails; compare sizes against the source.
When it happens
Trigger: Audio encoded in a codec the runtime cannot decode (e.g. ALAC, AC-3, DTS, E-AC-3, TrueHD, Opus-in-MP4 on some browsers, or an obscure FourCC); partial/truncated file where the codec init data is missing; DRM-protected audio; an audio track that is metadata-only.
Common situations: Using broadcast AC-3 audio from .ts/.mkv captures; Opus audio inside an MP4 container in older Chromium; ALAC from iTunes; MP4 with custom FourCC after a bad transcode; file truncated during upload so decoder setup fails.
Related errors
- Live streams are not currently supported by Remotion. Sorry!
- Streams with UNIX timestamps are not currently supported by
- Only supporting WAVE with PCM audio format, but got ${audioF
- Unsupported subformat: ${subFormat}
- No audio track found
AI-assisted analysis of remotion-dev/remotion@78fe4bb3fd (2026-08-12).
Data as JSON: /api/errors/91c229122a2b6466.
Report an issue: GitHub.