Can you get a live rtsp stream?

I hope this helps someone: I found out that the URLs generated by https://www.ispyconnect.com/man.aspx?n=dahua for my Dahua IPC-HDW5231R-ZE weren’t fully valid. However, I was able to generate a valid ?authbasic= via the script on the page. The valid URLs should be:

Mainstream

ffmpeg:
camera:
- platform: ffmpeg
  name: Camera
  input: -rtsp_transport tcp -i rtsp://USER:PASS@IPADDRESS/cam/realmonitor?channel=1&subtype=0&authbasic=GENERATEDCODE

Substream #2

ffmpeg:
camera:
- platform: ffmpeg
  name: Camera
  input: -rtsp_transport tcp -i rtsp://USER:PASS@IPADDRESS/cam/realmonitor?channel=1&subtype=2&authbasic=GENERATEDCODE

The authbasic can be generated with the following Javascript code:
var auth = btoa(cfg.username + ":" + cfg.password);

The above works like a charme without credentials modal in both VLC and Hassio.

Any chance you could provide more details on your approach? Is it applicable more generally i.e. on other than Dahua cameras? For a noob where does the script reside?

Other brands are probably possible too, for example, there also seems to be a page for hikvision cameras: https://www.ispyconnect.com/man.aspx?n=hikvision

I have mentioned the part of the script in my post, you can try it by using the following script as jsfiddle (and press run):

var auth = btoa("username_here" + ":" + "password_here");
document.write(auth);

Hope this helps!

1 Like