AlexxIT/go2rtc · error
streams:
Error message
streams:
What it means
streams.AddConsumer collects all error messages gathered while trying to link a consumer to a producer's medias/codecs. If any errors were accumulated (text non-empty), it returns "streams: <combined errors>" via formatError. This typically wraps codec-negotiation or media-mismatch failures between the stream's producer and the requested consumer.
Solutions
- Check the producer's codecs (via the streams info API) and use a consumer supporting them
- Add transcoding (e.g. exec: ffmpeg with -c:v libx264) or a source that emits compatible codecs
- Use a consumer type that matches the producer (e.g. HLS/WebRTC for H.265 instead of MSE)
- Read the text after "streams: " — it contains the per-media underlying errors
Example fix
// before — H.265 source to MSE (unsupported)
streams: {cam: "rtsp://cam/track1?h265"}
// after — transcode to H.264
streams:
cam:
- rtsp://cam/track1
- exec:ffmpeg#input=rtsp://cam/track1#output=rtp://127.0.0.1:10000#encoder=libx264 Defensive patterns
Strategy: try-catch
Validate before calling
// Query producer codecs before AddConsumer curl -f "http://host:1984/api/streams?src=cam" # inspect medias/codecs
Try / catch
// Go
if err := stream.AddConsumer(cons); err != nil {
if strings.HasPrefix(err.Error(), "streams: ") {
log.Warn().Msgf("codec/media mismatch: %v", err) // details after prefix
}
return err
} Prevention
- Match consumer type to producer codecs (H.265 => HLS/WebRTC, not MSE)
- Use exec:ffmpeg transcoding for incompatible codecs
- Read the concatenated detail after "streams: " to identify the failing media
- Test camera codec output before wiring consumers
When it happens
Trigger: Calling AddConsumer on a stream whose producer's medias don't match what the consumer can accept, or producer/consumer errors occurred during medias matching — e.g. camera publishes codecs the consumer can't handle (H.265 to an MJPEG consumer, missing audio to audio-only consumer, etc.).
Common situations: Playing a stream whose codecs are unsupported by the browser (H.265/HEVC in MSE), requesting a consumer type incompatible with the producer's media, or cameras with exotic codec combinations.
Related errors
AI-assisted analysis of AlexxIT/go2rtc@c245815e75 (2026-09-07).
Data as JSON: /api/errors/35cf4a544060b3b4.
Report an issue: GitHub.
Appendix: source
Thrown at internal/streams/add_consumer.go:128
for _, prod := range prodStarts {
prod.start()
}
return nil
}
func formatError(consMedias, prodMedias []*core.Media, prodErrors []error) error {
// 1. Return errors if any not nil
var text string
for _, err := range prodErrors {
if err != nil {
text = appendString(text, err.Error())
}
}
if len(text) != 0 {
return errors.New("streams: " + text)
}
// 2. Return "codecs not matched"
if prodMedias != nil {
var prod, cons string
for _, media := range prodMedias {
if media.Direction == core.DirectionRecvonly {
for _, codec := range media.Codecs {
prod = appendString(prod, media.Kind+":"+codec.PrintName())
}
}
}
for _, media := range consMedias {
if media.Direction == core.DirectionSendonly {
for _, codec := range media.Codecs {
cons = appendString(cons, media.Kind+":"+codec.PrintName())View on GitHub (pinned to c245815e75)