AlexxIT/go2rtc · error

waw: unsupported codec

Error message

waw: unsupported codec

What it means

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.

Solutions

  1. Re-encode the WAV to plain PCM 16-bit (standard WAVE format tag 1) before feeding it to the library
  2. Inspect the WAV header (ffprobe/mediainfo) to confirm the format tag is a common PCM type
  3. If the source can't be changed, convert with ffmpeg: ffmpeg -i in.wav -acodec pcm_s16le out.wav

Example fix

// before
producer, err := wav.Open(floatEncodedWavFile)
// after
producer, err := wav.Open(pcmS16WavFile) // converted: ffmpeg -acodec pcm_s16le
Defensive patterns

Strategy: validation

Validate before calling

// pre-check the WAV format tag with ffprobe or a header parse
hdr, _ := wav.ReadHeader(file)
if hdr == nil || hdr.CodecName == "" { /* re-encode to pcm_s16le */ }

Try / catch

if err != nil {
    if strings.Contains(err.Error(), "unsupported codec") {
        // fall back to ffmpeg conversion pipeline
    }
    return err
}

Prevention

When it happens

Trigger: 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).

Common situations: 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.

Understand the failure class

Background: UnsupportedOperationException and "is not supported" errors: when a library deliberately refuses a call — this error's family across 30 libraries.

Related errors


AI-assisted analysis of AlexxIT/go2rtc@c245815e75 (2026-09-07). Data as JSON: /api/errors/8e65b9e1d53743f8. Report an issue: GitHub.

Appendix: source

Thrown at pkg/wav/producer.go:25

	"github.com/AlexxIT/go2rtc/pkg/core"
	"github.com/pion/rtp"
)

const FourCC = "RIFF"

func Open(r io.Reader) (*Producer, error) {
	// https://en.wikipedia.org/wiki/WAV
	// https://www.mmsp.ece.mcgill.ca/Documents/AudioFormats/WAVE/WAVE.html
	rd := bufio.NewReaderSize(r, core.BufferSize)

	codec, err := ReadHeader(r)
	if err != nil {
		return nil, err
	}

	if codec.Name == "" {
		return nil, errors.New("waw: unsupported codec")
	}

	medias := []*core.Media{
		{
			Kind:      core.KindAudio,
			Direction: core.DirectionRecvonly,
			Codecs:    []*core.Codec{codec},
		},
	}
	return &Producer{
		Connection: core.Connection{
			ID:         core.NewID(),
			FormatName: "wav",
			Medias:     medias,
			Transport:  r,
		},
		rd: rd,
	}, nil

View on GitHub (pinned to c245815e75)