AlexxIT/go2rtc · error

kasa: unsupported type:

Error message

kasa: unsupported type: 

What it means

The kasa Producer's probe() maps each media/control-track (ct) from the Kasa device's SDP/description to a mediamtx media definition. When the codec/type string is not one of the supported cases in the switch, probing fails with this error, appending the unknown type. It means the device announced a codec or track type this client cannot handle.

Solutions

  1. Log the offending ct value from the error to identify which codec/type is unsupported.
  2. Force the device to output a supported codec (e.g. H264 video, PCMA/PCMU audio) via its config.
  3. Patch pkg/kasa/producer.go to add a case for the new type, mapping it to a suitable mediamtx media definition.
  4. Update/downgrade device firmware to a version advertising supported codecs.

Example fix

// before
default:
	return errors.New("kasa: unsupported type: " + ct)
// after
case "opus":
	media = &mediamtx.Media{
		Type: mediamtx.TypeAudio,
		Formats: []*mediamtx.Format{mediamtx.NewFormatOpus(48000)},
	}
default:
	return errors.New("kasa: unsupported type: " + ct)
Defensive patterns

Strategy: validation

Validate before calling

// pre-check device-advertised codecs against supported set
var supported = map[string]bool{"h264": true, "pcma": true, "pcmu": true}
for _, ct := range deviceTypes {
	if !supported[strings.ToLower(ct)] {
		return fmt.Errorf("device advertises unsupported type %q", ct)
	}
}

Try / catch

err := producer.Start() // triggers probe()
if err != nil {
	if strings.HasPrefix(err.Error(), "kasa: unsupported type:") {
		ct := strings.TrimPrefix(err.Error(), "kasa: unsupported type: ")
		return fmt.Errorf("reconfigure camera codec %q", ct)
	}
	return err
}

Prevention

When it happens

Trigger: Producer.probe() iterates over media/control types from the Kasa device and hits a string not covered by its switch cases (unsupported audio/video codec or track type).

Common situations: Camera firmware advertises an extra or proprietary codec (e.g. an unsupported audio codec at 8000 Hz clock); newer device models with codecs absent from the switch; wrong device protocol leading to garbage type strings.

Related errors


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

Appendix: source

Thrown at pkg/kasa/producer.go:197

		case MimeG711U:
			if !waitAudio {
				continue
			}
			waitAudio = false

			media = &core.Media{
				Kind:      core.KindAudio,
				Direction: core.DirectionRecvonly,
				Codecs: []*core.Codec{
					{
						Name:      core.CodecPCMU,
						ClockRate: 8000,
					},
				},
			}

		default:
			return errors.New("kasa: unsupported type: " + ct)
		}

		c.Medias = append(c.Medias, media)
	}

	return nil
}

// GetTimestamp - return timestamp in seconds
func GetTimestamp(header http.Header) float64 {
	if s := header.Get("X-Timestamp"); s != "" {
		if f, _ := strconv.ParseFloat(s, 32); f != 0 {
			return f
		}
	}

	return float64(time.Duration(time.Now().UnixNano()) / time.Second)
}

View on GitHub (pinned to c245815e75)