Skip to main content

Home Assistant with RTSPtoWeb

Siem Reap, Cambodia

Deprecated: Use go2rtc instead of RTSPtoWeb.

Making RTSP Streams Web-conform

RTSPtoWeb Installation

git clone https://github.com/deepch/RTSPtoWeb
cd RTSPtoWeb

Add your Cameras

Edit ./config.json to add your RTSP streams:

{
"server": {
"debug": true,
"http_debug": false,
"http_demo": true,
"http_dir": "web",
"http_login": "demo",
"http_password": "demo",
"http_port": ":8083",
"https": false,
"https_auto_tls": false,
"https_auto_tls_name": "",
"https_cert": "server.crt",
"https_key": "server.key",
"https_port": ":443",
"ice_servers": ["stun:stun.l.google.com:19302"],
"log_level": "debug",
"rtsp_port": ":5541",
"token": {
"backend": "http://127.0.0.1/test.php"
},
"defaults": {
"audio": true
}
},
"streams": {
"in-8015": {
"name": "INSTAR Full HD Camera",
"channels": {
"0": {
"name": "Full HD Stream",
"url": "rtsp://admin:instar@192.168.2.15/11",
"on_demand": true,
"debug": false,
"audio": true,
"status": 0
},
"1": {
"name": "HD Stream",
"url": "rtsp://admin:instar@192.168.2.15/12",
"on_demand": true,
"debug": false,
"audio": true,
"status": 0
}
}
},
"in-8415": {
"name": "INSTAR WQHD Camera",
"channels": {
"0": {
"name": "HD Stream",
"url": "rtsp://admin:instar@192.168.2.125:554/livestream/13",
"on_demand": true,
"debug": false,
"audio": true,
"status": 0
}
}
}
},
"channel_defaults": {
"on_demand": true
}
}

Note that RTSPtoWeb only supports h.264 with no audio. For WQHD cameras you will have to switch the compression from h.265 to h.264 in the camera webUI.

Start the Application

GO111MODULE=on go run *.go

And open the web user interface:

http://127.0.0.1:8083

Home Assistant with RTSPtoWeb

Home Assistant with RTSPtoWeb

Home Assistant

Installing Home Assistant

Run Home Assistant in Docker

Installing HACS

Update: It seems that installing HACS is no longer necessary. You can jump straight to installing the RTSP2WebRTC integration below!

Install the Home Assistant Community Store (HACS) inside the container:

docker exec -ti home-assistant /bin/bash
wget -O - https://get.hacs.xyz | bash -

Restart Home Assistant and add the HACS integration:

Home Assistant with RTSPtoWeb

You will need to have an Github account to be able to use the Github API:

Home Assistant with RTSPtoWeb

Installing RTSPtoWebRTC

Go to the Integrations page and select an instance of RTSPtoWebRTC:

Home Assistant with RTSPtoWeb

Install it and point it to your RTSPtoWeb interface URL, e.g. http://localhost:8083:

Home Assistant with RTSPtoWeb

Now we can add our camera's live stream to Home Assistant through the RTSPtoWebRTC integration. The RTSPtoWeb integration registers with camera integration to provide WebRTC live streams for any RTSP camera.

So make sure that you have your cameras already added, e.g. as Generic Cameras:

Home Assistant with RTSPtoWeb

The RTSPtoWebRTC integration will now use RTSPtoWeb to receive the WebRTC stream from your generic camera's RTSP Stream:

Home Assistant with RTSPtoWeb

Home Assistant with RTSPtoWeb