{"record":{"id":"e44aa9dc8eae3c80","repo":"remotion-dev/remotion","slug":"unknown-audio-format-codec-format","errorCode":null,"errorMessage":"Unknown audio format: ${codec.format}","messagePattern":"Unknown audio format: (.+?)","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"packages/media-parser/src/get-audio-codec.ts","lineNumber":349,"sourceCode":"\t}\n\n\tif (codec.format === 'mp4a') {\n\t\tif (codec.primarySpecificator === 0x40) {\n\t\t\treturn 'aac';\n\t\t}\n\n\t\tif (codec.primarySpecificator === 0x6b) {\n\t\t\treturn 'mp3';\n\t\t}\n\n\t\tif (codec.primarySpecificator === null) {\n\t\t\treturn 'aac';\n\t\t}\n\n\t\tthrow new Error('Unknown mp4a codec: ' + codec.primarySpecificator);\n\t}\n\n\tthrow new Error(`Unknown audio format: ${codec.format}`);\n};\n\nexport const getAudioCodecFromTrack = (track: TrakBox) => {\n\tconst audioSample = getAudioCodecFromTrak(track);\n\tif (!audioSample) {\n\t\tthrow new Error('Could not find audio sample');\n\t}\n\n\treturn getAudioCodecFromAudioCodecInfo(audioSample);\n};\n","sourceCodeStart":331,"sourceCodeEnd":360,"githubUrl":"https://github.com/remotion-dev/remotion/blob/78fe4bb3fdb5a2cd68724393d63cb223db333fa7/packages/media-parser/src/get-audio-codec.ts#L331-L360","documentation":"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.","triggerScenarios":"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.","commonSituations":"Processing heterogeneous user uploads (ALAC FLAC, AMR). Parsing files with newer codecs before the parser supports them. Encountering legacy formats from mobile recorders.","solutions":["Transcode the source to a supported audio codec (AAC, MP3, PCM, Opus, AC-3) before parsing.","Catch the error and surface a clear 'unsupported codec' message to the user; skip the track.","Verify codec support with ffprobe first and skip unsupported files."],"exampleFix":"// before\nconst codec = getAudioCodecFromTrack(trak);\n\n// after\nlet codec;\ntry {\n  codec = getAudioCodecFromTrack(trak);\n} catch (err) {\n  codec = null;\n  console.warn('Unsupported audio format, skipping:', err.message);\n}","handlingStrategy":"try-catch","validationCode":"const knownFormats = ['twos','in24','lpcm','sowt','ac-3','Opus','mp4a'];\nconst info = getAudioCodecFromTrak(trak);\nif (!info || !knownFormats.includes(info.format)) { /* unsupported */ }","typeGuard":"null","tryCatchPattern":"try { getAudioCodecFromAudioCodecInfo(info); } catch (e) { if (e.message.startsWith('Unknown audio format')) { /* skip */ } else throw e; }","preventionTips":["Pre-validate audio codec with ffprobe.","Transcode unsupported codecs to AAC/MP3/Opus/PCM/AC-3.","Catch and report unsupported-format errors gracefully."],"tags":["mp4","audio","codec","unsupported"],"backgroundTag":null,"analyzedSha":"78fe4bb3fdb5a2cd68724393d63cb223db333fa7","analyzedAt":"2026-08-12T17:18:50.444Z","schemaVersion":2},"datasetVersion":"2026-08-12T23:17:12.415Z"}