go2rtc with Xiaomi Camera RTSP: Feed NVR, HomeKit, and Frigate

A practical setup note for pulling Xiaomi camera RTSP via go2rtc and using it across NVR, HomeKit, and Frigate.

This note shows how to use go2rtc to pull Xiaomi camera streams directly and reuse them across NVR, HomeKit, and Frigate.

Docker deployment example

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
services:
  go2rtc:
    container_name: go2rtc
    image: alexxit/go2rtc:master-hardware
    restart: always
    network_mode: host
    privileged: true
    environment:
      - TZ=Asia/Shanghai
    volumes:
      - /vol1/1000/docker/go2rtc:/config

go2rtc web UI:

1
http://192.168.3.217:1984/

Stream config example

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
streams:
    micam1:
     - xiaomi://xxx
    #H265转H264,Homekit预览会用到
    #micam1_h264:
     #- ffmpeg:micam1#video=h264#width=1280#height=720#hardware#raw=-r 15
    micam2:
     - xiaomi://xxx
    micam3:
     - xiaomi://xxx

RTSP URL format:

1
rtsp://192.168.3.217:8554/micam1

Quality and parameters

Quality is controlled with values from 0 to 5:

  • 0 usually means auto
  • 1 means sd
  • 2 means hd (default in go2rtc)

Some newer models may map HD to 3. Older models can break codec settings at 3, so avoid applying one fixed value to all devices.

Use subtype=hd/sd/auto/0-5 to set quality:

1
2
streams:
  xiaomi1: xiaomi://***&subtype=sd

For dual-lens cameras, use second channel with channel=2:

1
2
streams:
  xiaomi1: xiaomi://***&channel=2

Summary

Once go2rtc is in front, one RTSP source can serve NVR recording, Frigate detection, and HomeKit preview at the same time, which simplifies maintenance.

References

记录并分享
Built with Hugo
Theme Stack designed by Jimmy