{"record":{"id":"8e65b9e1d53743f8","repo":"AlexxIT/go2rtc","slug":"waw-unsupported-codec","errorCode":null,"errorMessage":"waw: unsupported codec","messagePattern":"waw: unsupported codec","errorType":"error_code","errorClass":null,"httpStatus":null,"severity":"error","filePath":"pkg/wav/producer.go","lineNumber":25,"sourceCode":"\n\t\"github.com/AlexxIT/go2rtc/pkg/core\"\n\t\"github.com/pion/rtp\"\n)\n\nconst FourCC = \"RIFF\"\n\nfunc Open(r io.Reader) (*Producer, error) {\n\t// https://en.wikipedia.org/wiki/WAV\n\t// https://www.mmsp.ece.mcgill.ca/Documents/AudioFormats/WAVE/WAVE.html\n\trd := bufio.NewReaderSize(r, core.BufferSize)\n\n\tcodec, err := ReadHeader(r)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\tif codec.Name == \"\" {\n\t\treturn nil, errors.New(\"waw: unsupported codec\")\n\t}\n\n\tmedias := []*core.Media{\n\t\t{\n\t\t\tKind:      core.KindAudio,\n\t\t\tDirection: core.DirectionRecvonly,\n\t\t\tCodecs:    []*core.Codec{codec},\n\t\t},\n\t}\n\treturn &Producer{\n\t\tConnection: core.Connection{\n\t\t\tID:         core.NewID(),\n\t\t\tFormatName: \"wav\",\n\t\t\tMedias:     medias,\n\t\t\tTransport:  r,\n\t\t},\n\t\trd: rd,\n\t}, nil","sourceCodeStart":7,"sourceCodeEnd":43,"githubUrl":"https://github.com/AlexxIT/go2rtc/blob/c245815e75e2a5fd60b4290f12bfc04e55a984d3/pkg/wav/producer.go#L7-L43","documentation":"pkg/wav.Open reads a WAV header via ReadHeader and then checks whether the header identified a codec it supports. If the codec name came back empty, the WAV container is understood but its audio subformat (e.g. PCM variants, non-PCM like WAV extensible formats) is not mapped to any supported codec, so Open fails.","triggerScenarios":"Calling pkg/wav Open on an io.Reader whose WAV header parses but resolves to an empty codec name — e.g. a non-PCM WAV (IEEE float, extensible format-0xFFFE, or a format tag the parser doesn't recognize).","commonSituations":"Feeding a WAVE_FORMAT_EXTENSIBLE or float-encoded WAV produced by DAWs; passing a WAV with an unusual codec tag recorded by a voice recorder; piping audio where the header claims an unmapped format.","solutions":["Re-encode the WAV to plain PCM 16-bit (standard WAVE format tag 1) before feeding it to the library","Inspect the WAV header (ffprobe/mediainfo) to confirm the format tag is a common PCM type","If the source can't be changed, convert with ffmpeg: ffmpeg -i in.wav -acodec pcm_s16le out.wav"],"exampleFix":"// before\nproducer, err := wav.Open(floatEncodedWavFile)\n// after\nproducer, err := wav.Open(pcmS16WavFile) // converted: ffmpeg -acodec pcm_s16le","handlingStrategy":"validation","validationCode":"// pre-check the WAV format tag with ffprobe or a header parse\nhdr, _ := wav.ReadHeader(file)\nif hdr == nil || hdr.CodecName == \"\" { /* re-encode to pcm_s16le */ }","typeGuard":null,"tryCatchPattern":"if err != nil {\n    if strings.Contains(err.Error(), \"unsupported codec\") {\n        // fall back to ffmpeg conversion pipeline\n    }\n    return err\n}","preventionTips":["Standardize inputs on PCM 16-bit WAV","Probe audio files before feeding them to producers"],"tags":["wav","audio","codec","unsupported-format"],"backgroundTag":"unsupported-operation","analyzedSha":"c245815e75e2a5fd60b4290f12bfc04e55a984d3","analyzedAt":"2026-09-07T11:47:02.965Z","contentChangedAt":"2026-09-07T11:47:02.965Z","schemaVersion":2},"datasetVersion":"2026-09-16T04:17:20.429Z"}