{"record":{"id":"900c9d9f1468e820","repo":"remotion-dev/remotion","slug":"unsupported-bits-per-sample-bitspersample","errorCode":null,"errorMessage":"Unsupported bits per sample: ${bitsPerSample}","messagePattern":"Unsupported bits per sample: (.+?)","errorType":"exception","errorClass":"Error","httpStatus":null,"severity":"error","filePath":"packages/media-parser/src/containers/wav/parse-fmt.ts","lineNumber":76,"sourceCode":"\t\t);\n\t}\n\n\tconst numberOfChannels = iterator.getUint16Le();\n\tconst sampleRate = iterator.getUint32Le();\n\tconst byteRate = iterator.getUint32Le();\n\tconst blockAlign = iterator.getUint16Le();\n\tconst bitsPerSample = iterator.getUint16Le();\n\n\tconst format =\n\t\tbitsPerSample === 16\n\t\t\t? 'pcm-s16'\n\t\t\t: bitsPerSample === 32\n\t\t\t\t? 'pcm-s32'\n\t\t\t\t: bitsPerSample === 24\n\t\t\t\t\t? 'pcm-s24'\n\t\t\t\t\t: null;\n\tif (format === null) {\n\t\tthrow new Error(`Unsupported bits per sample: ${bitsPerSample}`);\n\t}\n\n\tconst wavHeader: WavFmt = {\n\t\tbitsPerSample,\n\t\tblockAlign,\n\t\tbyteRate,\n\t\tnumberOfChannels,\n\t\tsampleRate,\n\t\ttype: 'wav-fmt',\n\t};\n\n\tstate.structure.getWavStructure().boxes.push(wavHeader);\n\n\tif (audioFormat === 65534) {\n\t\tconst extraSize = iterator.getUint16Le();\n\t\tif (extraSize !== 22) {\n\t\t\tthrow new Error(\n\t\t\t\t`Only supporting WAVE with 22 extra bytes, but got ${extraSize} bytes extra size`,","sourceCodeStart":58,"sourceCodeEnd":94,"githubUrl":"https://github.com/remotion-dev/remotion/blob/78fe4bb3fdb5a2cd68724393d63cb223db333fa7/packages/media-parser/src/containers/wav/parse-fmt.ts#L58-L94","documentation":"After accepting the format tag, parseFmt maps bitsPerSample to a codec string: 16 -> pcm-s16, 32 -> pcm-s32, 24 -> pcm-s24. Any other bit depth has no mapping and is rejected because the WebCodecs decode path only covers those three. The thrown value is the raw bitsPerSample.","triggerScenarios":"A PCM WAV whose bitsPerSample is not 16/24/32: most often 8-bit PCM, 32-bit float mislabeled with wFormatTag 1, or unusual 12/20/48-bit depths.","commonSituations":"8-bit WAVs from old games/samplers; 32-bit float files saved without the EXTENSIBLE wrapper; niche high-res audio.","solutions":["Inspect bitsPerSample via ffprobe or soxi.","Convert to a supported depth: ffmpeg -i in.wav -c:a pcm_s16le out.wav (or pcm_s24le / pcm_s32le).","For 8-bit sources, upscale to 16-bit with ffmpeg.","Use Mediabunny; fall back in try/catch otherwise."],"exampleFix":"# 8-bit WAV -> 16-bit PCM\nffmpeg -i in.wav -c:a pcm_s16le out.wav\n\nawait parseMedia({ src: 'out.wav' });","handlingStrategy":"try-catch","validationCode":"// check bit depth first\n// ffprobe -show_entries stream=bits_per_sample -of default=nw=1 in.wav\n// must be 16, 24, or 32","typeGuard":"const SUPPORTED_BITS = new Set([16, 24, 32]);\nconst isSupportedBitDepth = (bits: number) => SUPPORTED_BITS.has(bits);","tryCatchPattern":"try {\n  await parseMedia({ src: 'in.wav' });\n} catch (err) {\n  if (err instanceof Error && /bits per sample/i.test(err.message)) {\n    // unsupported depth — convert with ffmpeg or skip\n  } else throw err;\n}","preventionTips":["Normalize bit depth to 16/24/32 when generating assets.","Probe bits_per_sample before parsing.","Fall back to Mediabunny for unusual depths."],"tags":["wav","media-parser","unsupported-format","audio","pcm"],"backgroundTag":null,"analyzedSha":"78fe4bb3fdb5a2cd68724393d63cb223db333fa7","analyzedAt":"2026-08-12T17:18:50.444Z","schemaVersion":2},"datasetVersion":"2026-08-12T18:17:37.767Z"}