{"record":{"id":"b713507fab861db9","repo":"AlexxIT/go2rtc","slug":"no-audio","errorCode":null,"errorMessage":"no audio","messagePattern":"no audio","errorType":"error_code","errorClass":null,"httpStatus":null,"severity":"error","filePath":"pkg/xiaomi/miss/producer.go","lineNumber":64,"sourceCode":"\t\t\tRemoteAddr: client.RemoteAddr().String(),\n\t\t\tUserAgent:  client.Version(),\n\t\t\tMedias:     medias,\n\t\t\tTransport:  client,\n\t\t},\n\t\tclient: client,\n\t}, nil\n}\n\nfunc probe(client *Client, audio bool) ([]*core.Media, error) {\n\t_ = client.SetDeadline(time.Now().Add(15 * time.Second))\n\n\tvar vcodec, acodec *core.Codec\n\n\tfor {\n\t\tpkt, err := client.ReadPacket()\n\t\tif err != nil {\n\t\t\tif vcodec != nil {\n\t\t\t\terr = fmt.Errorf(\"no audio\")\n\t\t\t} else if acodec != nil {\n\t\t\t\terr = fmt.Errorf(\"no video\")\n\t\t\t}\n\t\t\treturn nil, fmt.Errorf(\"xiaomi: probe: %w\", err)\n\t\t}\n\n\t\tswitch pkt.CodecID {\n\t\tcase codecH264:\n\t\t\tif vcodec == nil {\n\t\t\t\tbuf := annexb.EncodeToAVCC(pkt.Payload)\n\t\t\t\tif h264.NALUType(buf) == h264.NALUTypeSPS {\n\t\t\t\t\tvcodec = h264.AVCCToCodec(buf)\n\t\t\t\t}\n\t\t\t}\n\t\tcase codecH265:\n\t\t\tif vcodec == nil {\n\t\t\t\tbuf := annexb.EncodeToAVCC(pkt.Payload)\n\t\t\t\tif h265.NALUType(buf) == h265.NALUTypeVPS {","sourceCodeStart":46,"sourceCodeEnd":82,"githubUrl":"https://github.com/AlexxIT/go2rtc/blob/c245815e75e2a5fd60b4290f12bfc04e55a984d3/pkg/xiaomi/miss/producer.go#L46-L82","documentation":"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.","triggerScenarios":"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.","commonSituations":"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.","solutions":["Enable audio on the camera (vendor app / camera settings) and retry Dial.","Verify the stream URL/profile actually includes an audio track by probing with ffprobe.","Handle the error in the caller: treat \"no audio\" as video-only and proceed with a video-only producer if the application tolerates it.","Check network stability/camera uptime; a persistent disconnect before audio packets indicates a transport problem, not a config one."],"exampleFix":"// before\nproducer, err := miss.Dial(ctx, url) // fails: xiaomi: probe: no audio\n// after\nproducer, err := miss.Dial(ctx, url)\nif err != nil {\n    if strings.Contains(err.Error(), \"no audio\") {\n        logger.Warn(\"camera stream has no audio track; continuing video-only\")\n        producer, err = miss.DialVideoOnly(ctx, url) // or configure app to accept video-only\n    }\n}","handlingStrategy":"try-catch","validationCode":"// Go: probe the stream yourself before Dial to confirm an audio track exists\nout, err := exec.Command(\"ffprobe\", \"-v\", \"error\", \"-select_streams\", \"a\", \"-show_entries\", \"stream=codec_name\", \"-of\", \"csv=p=0\", url).Output()\nif err != nil || len(strings.TrimSpace(string(out))) == 0 {\n    // no audio track expected; skip Dial or use video-only path\n}","typeGuard":null,"tryCatchPattern":"producer, err := miss.Dial(ctx, url)\nif err != nil {\n    if strings.Contains(err.Error(), \"no audio\") {\n        // handle video-only stream\n        return handleVideoOnly(url)\n    }\n    return fmt.Errorf(\"dial: %w\", err)\n}","preventionTips":["Enable audio in the camera settings before wiring the stream.","Run ffprobe against the stream URL during deployment checks.","Write callers that tolerate video-only streams instead of failing hard.","Monitor camera connection stability to distinguish config issues from transport drops."],"tags":["streaming","audio","rtsp","camera","probe"],"backgroundTag":"missing-audio-track","analyzedSha":"c245815e75e2a5fd60b4290f12bfc04e55a984d3","analyzedAt":"2026-09-07T11:47:02.965Z","contentChangedAt":"2026-09-07T11:47:02.965Z","schemaVersion":2},"datasetVersion":"2026-09-15T23:17:13.987Z"}