AlexxIT/go2rtc · error

no audio

Error message

no audio

What it means

During probing of a Xiaomi (Mi) camera stream, the connection ended (ReadPacket returned an error) before any audio codec was negotiated, although a video codec was found. The library wraps the ReadPacket failure as "no audio" and returns it wrapped as "xiaomi: probe: no audio". It signals that the stream carries video only, or that the source dropped before audio frames arrived.

Solutions

  1. Enable audio on the camera (vendor app / camera settings) and retry Dial.
  2. Verify the stream URL/profile actually includes an audio track by probing with ffprobe.
  3. Handle the error in the caller: treat "no audio" as video-only and proceed with a video-only producer if the application tolerates it.
  4. Check network stability/camera uptime; a persistent disconnect before audio packets indicates a transport problem, not a config one.

Example fix

// before
producer, err := miss.Dial(ctx, url) // fails: xiaomi: probe: no audio
// after
producer, err := miss.Dial(ctx, url)
if err != nil {
    if strings.Contains(err.Error(), "no audio") {
        logger.Warn("camera stream has no audio track; continuing video-only")
        producer, err = miss.DialVideoOnly(ctx, url) // or configure app to accept video-only
    }
}
Defensive patterns

Strategy: try-catch

Validate before calling

// Go: probe the stream yourself before Dial to confirm an audio track exists
out, err := exec.Command("ffprobe", "-v", "error", "-select_streams", "a", "-show_entries", "stream=codec_name", "-of", "csv=p=0", url).Output()
if err != nil || len(strings.TrimSpace(string(out))) == 0 {
    // no audio track expected; skip Dial or use video-only path
}

Try / catch

producer, err := miss.Dial(ctx, url)
if err != nil {
    if strings.Contains(err.Error(), "no audio") {
        // handle video-only stream
        return handleVideoOnly(url)
    }
    return fmt.Errorf("dial: %w", err)
}

Prevention

When it happens

Trigger: Calling Dial on a Xiaomi stream whose source sends H264 packets but terminates/errors before any audio packet arrives, so probe's read loop exits with vcodec != nil and acodec == nil.

Common situations: Cameras configured with audio disabled in their vendor app; firmware that records video-only streams; network drop or camera reboot mid-probe; RTSP/miss client disconnecting right after the first video keyframe.

Related errors


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

Appendix: source

Thrown at pkg/xiaomi/miss/producer.go:64

			RemoteAddr: client.RemoteAddr().String(),
			UserAgent:  client.Version(),
			Medias:     medias,
			Transport:  client,
		},
		client: client,
	}, nil
}

func probe(client *Client, audio bool) ([]*core.Media, error) {
	_ = client.SetDeadline(time.Now().Add(15 * time.Second))

	var vcodec, acodec *core.Codec

	for {
		pkt, err := client.ReadPacket()
		if err != nil {
			if vcodec != nil {
				err = fmt.Errorf("no audio")
			} else if acodec != nil {
				err = fmt.Errorf("no video")
			}
			return nil, fmt.Errorf("xiaomi: probe: %w", err)
		}

		switch pkt.CodecID {
		case codecH264:
			if vcodec == nil {
				buf := annexb.EncodeToAVCC(pkt.Payload)
				if h264.NALUType(buf) == h264.NALUTypeSPS {
					vcodec = h264.AVCCToCodec(buf)
				}
			}
		case codecH265:
			if vcodec == nil {
				buf := annexb.EncodeToAVCC(pkt.Payload)
				if h265.NALUType(buf) == h265.NALUTypeVPS {

View on GitHub (pinned to c245815e75)