AlexxIT/go2rtc · error

wyze: no audio codec detected from camera

Error message

wyze: no audio codec detected from camera

What it means

Returned by the Wyze Producer's AddTrack during backchannel setup. After intercom is enabled, it queries the camera's audio codec via GetBackchannelCodec(); a codec value of 0 means the camera never reported what audio format it accepts, so go2rtc cannot negotiate the upstream (talk) track and aborts.

Solutions

  1. Wait/check that the camera actually starts sending audio after intercom (packet capture on the TUTK channel)
  2. Update camera firmware; older builds may not report backchannel codec info
  3. Verify the model supports two-way audio at all (test talk in the Wyze app)
  4. Retry the session — a race between intercom enable and codec query can yield 0 on first attempt
  5. If the camera only ever returns 0, use a one-way stream and skip backchannel setup

Example fix

// before
// immediately querying codec right after StartIntercom
codec, rate, ch := client.GetBackchannelCodec() // 0 -> error
// after
// ensure intercom session is established / retry with timeout
deadline := time.After(3 * time.Second)
for codec == 0 {
    select {
    case <-deadline:
        return errors.New("wyze: no backchannel codec from camera")
    case <-time.After(100 * time.Millisecond):
        codec, rate, ch = client.GetBackchannelCodec()
    }
}
Defensive patterns

Strategy: retry

Validate before calling

// Go: confirm codec before building the track
if codec, _, _ := client.GetBackchannelCodec(); codec == 0 {
    return errors.New("no backchannel codec yet; wait or use one-way stream")
}

Type guard

func hasBackchannelCodec(codec uint16) bool { return codec != 0 }

Try / catch

if err := producer.AddTrack(media, codec, track); err != nil {
    if strings.Contains(err.Error(), "no audio codec detected") {
        time.Sleep(500 * time.Millisecond) // race: retry once
        return producer.AddTrack(media, codec, track)
    }
    return err
}

Prevention

When it happens

Trigger: AddTrack on a Wyze stream when GetBackchannelCodec() returns 0: intercom succeeded but no audio frames/codec info arrived from the camera, the TUTK backchannel channel was not opened, or the firmware does not expose codec metadata.

Common situations: Camera model whose firmware omits backchannel codec info; intercom mode toggled but the audio stream never started; race where codec query runs before the camera answers; unsupported or very old firmware.

Related errors


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

Appendix: source

Thrown at pkg/wyze/backchannel.go:20

import (
	"fmt"

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

func (p *Producer) AddTrack(media *core.Media, codec *core.Codec, track *core.Receiver) error {
	if err := p.client.StartIntercom(); err != nil {
		return fmt.Errorf("wyze: failed to enable intercom: %w", err)
	}

	// Get the camera's audio codec info (what it sent us = what it accepts)
	tutkCodec, sampleRate, channels := p.client.GetBackchannelCodec()
	if tutkCodec == 0 {
		return fmt.Errorf("wyze: no audio codec detected from camera")
	}

	if p.client.verbose {
		fmt.Printf("[Wyze] Intercom enabled, using codec=0x%04x rate=%d ch=%d\n", tutkCodec, sampleRate, channels)
	}

	sender := core.NewSender(media, track.Codec)

	// Track our own timestamp - camera expects timestamps starting from 0
	// and incrementing by frame duration in microseconds
	var timestamp uint32 = 0
	samplesPerFrame := tutk.GetSamplesPerFrame(tutkCodec)
	frameDurationUS := samplesPerFrame * 1000000 / sampleRate

	sender.Handler = func(pkt *rtp.Packet) {
		if err := p.client.WriteAudio(tutkCodec, pkt.Payload, timestamp, sampleRate, channels); err == nil {
			p.Send += len(pkt.Payload)
		}

View on GitHub (pinned to c245815e75)