项目地址:在此
按照作者的意思,手上正好有一个G2摄像头,按照操作来了以后报错,作者的项目是获取摄像头的token和ip以后,就可以拉流,原本摄像头不会被破坏。
项目名称:videoP2Proxy
通过代理的方式使用标准协议的代理小米P2P专用摄像头。
无需更改摄像头固件即可正常工作,摄像头接入米家仍在可以继续工作。
已测试型号
*Aqara智能网关摄像头G2 : lumi.camera.aq1
*其他小米摄像头也应正常工作,请进行测试并[报告有问题]
快速开始
(作者用的树莓派,我没有,我用群晖虚拟机整了个ubuntu,群晖docker的ubuntu好像有啥问题,反正不太对,另外使用全局网络,并且关闭ipv6,我的机场不提供ipv6全局,然后这个ubuntu获取了ipv6地址,就使用ipv6地址去下载,几k每秒的速度,关了ipv6跑的速度嗖嗖的)
安装依赖
- 安装依赖包
sudo apt-get install build-essential git python3 python3-dev autoconf automake libtool liblivemedia-dev libjson-c-dev
- 安装python-miio https://github.com/rytilahti/python-miio
pip3 install python-miio
我这里提示pip3 command not found,就再用了一个
sudo apt install python3-pip
克隆存储库
git clone https://github.com/miguelangel-nubla/videoP2Proxy.git
cd videoP2Proxy
Build
./autogen.sh
make
sudo make install
运行RTSP代理
videop2proxy --ip CAMERA_IP --token CAMERA_HEX_TOKEN --rtsp 8554
此处ip改为自己的摄像头ip和你获取的摄像头token
正确接入以后应该是这样
Starting proxy…
Starting RTSP server on “rtsp://192.168.1.2:8554/”
(Using port 8000 for optional RTSP-over-HTTP tunneling.)
[P2P client] starting…
IOTC_Initialize2…
IOTC_Connect_ByUID_Parallel… SID:0
avClientStart2… userName: c8da138df16 passWord: a1c8da1df11a
avClientStart2 mAvIndex=0
startIOTC video ret=0
startIOTC audio ret=0
[P2P client] running
[ReceiveVideo] Running
[ReceiveAudio] Running
在Home Assistant里面使用
camera:
- platform: ffmpeg
input: -rtsp_transport tcp -i rtsp://192.168.1.2:8554/
因为是代理的rtsp,所以流地址也是使用你跑这个videoP2Proxy项目的设备ip,而不是摄像头ip
我不知道啥原因,请各位大兄弟有的都可以试试,不用在摄像头上操作,有设备可以跑作者的插件就行,但是我肯定ip和token没错,还有大兄弟有这款摄像头吗?因为这个可以在米家app上正常工作的同时,也可以通过他拉出来的rtsp接入HA或者NR,我感觉很不错,关键是,不用再买摄像头了,这是我的报错
Error connecting to camera, make sure ip and token are correct.
Error, waiting 10 seconds and trying again.