#2386·go2rtc

源: 在每次 WebRTC 协商中重复 H264 接收器轨道, RTSP 输出连接到空闲的轨道

作者: Mathbl创建于 2026年7月30日更新于 2026年10月1日
标签enhancementbrand/nest
  • go2rtc version 1.9.10 (df95ce3) linux/amd64
  • Bundled inside ghcr.io/blakeblackshear/frigate:stable, Debian 12 base
  • Host: Unraid, container network mode host
  • Camera: Nest Doorbell Gen 2 (wired), connected via the built-in nest: source (Google SDM API / Device Access), no Home Assistant involved
  • Consumer: Frigate's ffmpeg pulls from go2rtc over local RTSP (preset-rtsp-restream, -rtsp_transport tcp)

Symptom

Every single WebRTC negotiation between go2rtc and the Nest SDM API for this doorbell results in two separate H264 receiver tracks inside the same producer:

  • One receiver has childs (i.e. it is wired to the RTSP consumer's sender) but never receives any bytes (the bytes/packets fields are absent, i.e. zero, for the entire life of the producer).
  • A second, separate H264 receiver is not wired to any consumer but receives all the real incoming video data (bytes/packets grow continuously). Because the RTSP output is bound to the empty receiver, Frigate's ffmpeg never gets usable video and fails with: [rtsp @ ...] Could not find codec parameters for stream 0 (Video: h264, none): unspecified size Consider increasing the value for the 'analyzeduration' (0) and 'probesize' (500000) options [out#0/segment @ ...] Output file does not contain any stream This triggers Frigate's watchdog to kill and restart ffmpeg every ~20s, which in turn causes go2rtc to tear down and re-negotiate a brand new WebRTC session with Nest every ~20s — a continuous reconnect loop that has apparently been running for weeks.

Reproduction rate

Observed 6 consecutive fresh negotiations (passively, driven by Frigate's ffmpeg reconnect loop, no manual intervention) over ~90 seconds: 6/6 showed the same wrong wiring. Also reproduced immediately after a manual restart of the go2rtc service (2/2). This looks fully deterministic for this device, not a rare race.

Example /api/streams output (credentials redacted)

json
{
  "doorbell_nest": {
    "producers": [{
      "id": 194, 
      "format_name": "nest/webrtc",
      "protocol": "http+udp",
      "remote_addr": "74.125.247.225:19305 host",
      "url": "nest:?client_id=REDACTED&client_secret=REDACTED&refresh_token=REDACTED&project_id=REDACTED&device_id=REDACTED",
      "medias": ["video, recvonly, H264", "audio, recvonly, OPUS/48000/2"],
      "receivers": [
        {"id": 195, "codec": {"codec_name": "h264", "codec_type": "video"}, "childs": [196]},
        {"id": 197, "codec": {"channels": 2, "codec_name": "opus", "codec_type": "audio", "sample_rate": 48000}, "bytes": 1694,
  "packets": 7},
        {"id": 198, "codec": {"codec_name": "h264", "codec_type": "video"}, "bytes": 9152, "packets": 9}
      ],
      "bytes_recv": 11230
    }],
    "consumers": [{
      "id": 193, 
      "format_name": "rtsp",
      "protocol": "rtsp+tcp",
      "senders": [{"id": 194, "codec": {"codec_name": "h264", "codec_type": "video"}, "bytes": 11230, "packets": 10},
…