How to add rtsp camera in hassio card live stream

Hi,
can any one please guide me how to add rtsp camera in my UI with camera live stream. I dont know how to add it. I am using Hassio in virtual machine in windows by using vmdk file.
thank you

1 Like

I study that Stream component. But I dont know what is the code or how to write code for camera.

1 Like

Are we supposed to guess what type of camera?

It is IP CCTV Camera. It shows software Nat.OnvifS.2016. I use CMS software to access camera settings. It shows H.264 compression. Bit rate type VBR. It shows OnVif port 8899, HTTP Port: 80, Media Port: 34567. Also there are lot of services like FTP, RTSP.
currently I can access video on VLC player with this URL:
rtsp://192.168.XX.XXX:554/user=XXXX&password=XXXX&channel=1&stream=0.sdp
thank you

did you try that string in the stream_source?

1 Like

can you please provide configuration yaml code for rtsp. I am so struggling.

The joys of homeassistant! So many ways to do things!
If you want to use the stream component you simply add

stream:

To your configuration.yaml file.

Now you also need to have a camera defined to stream from.
There are several ways to do this depending on the camera and its capabilities.
You can start with the generic camera config.

Go all the way down to the bottom of the page for the live stream.

Hope this helps a bit.

I’ve found that the rstp url is different for just about every camera out there. You should google your camera and rstp and someone will have the correct url out there. Or look in your camera manual.

below is the info from camera manufacturer:
Yes, they are compliant with ONVIF specification/standard. You can use the CMSClient to get the IP address.The Onvif information - ONVIF port: 5000; Device discovery port: 3702; additionally, you can use the VLC or QuickTime or even other third-party VMS to play the RTSP video stream.
The camera’s RTSP url: rtsp://IPadr:554/onvif1
Main stream rtsp://IPadr:554/onvif1
Sub-stream rtsp://IPadr:554/onvif2
IPadr = the camera’s IP address.

From https://support.yooseecamera.com/threads/10/

based on this info, i have below code entered in the config yaml file.

stream:

Example configuration.yaml entry

camera:

  • platform: generic
    name: garage
    username: xxx
    password: xxx
    stream_source: rtsp://192.168.x.xxx:554/onvif1

when i try to add camera to lovelace as per instructions on https://www.home-assistant.io/integrations/stream,

i dont see appearing under the entity list, what to do next to view the live stream?help plz

1 Like

You can try this:

camera:
  - platform: generic
    stream_source:  rtsp://192.168.......:8554/unicast
    still_image_url: https://192.168...../cgi-bin/currentpic.cgi
    name: Voordeur Camera
    verify_ssl: false
    authentication: basic
    username: 
    password: 

I know this is an old thread, but I found a solution for what I understand to be the OP’s similar issue. I used the camera platform “ffmpeg” with an RTSP stream and so far, it works great.

- platform: ffmpeg
  name: Front Door
  input: rtsp://<username>:<pw>@<ip>:554/<path-to-stream>
4 Likes

I wanted to add, that I have used HA for over a year now, but its been about a year since I configured anything. I went to add some cameras that I had purchased from Unifi to HA.

And I struggled mightily.
It really irritates me when people post links to the documentation- I’ve read it. I can find it just fine. The documentation is often not clear.

I have sought a way in the past to edit the doc for something I did understand, but I couldn’t find an easy way. Soty of a WIki. THe Documentation here while covering most things, very often leaves huge holes in the data. Major steps are skipped. Or often - it’ll say “add the camera, then the services can be called directly”
Now that may be obvious to you old hats. But I am sitting here saying what services. How do I access that. What is the FREAKING entity id?
Stream:
Takes no parameters.
Do I have to add the parameters in side Automations.
The services documentation is totally devoid of useful information.
Adding entities makes no sense to me, I supply a name, which is not an entityID.
Supplying anentity_id produces an error.

Maybe a year ago more of this made sense, but I recall I fell well short of my goals then.

The documentation MUST be improved. All the answers end up buried on the forum and we could leverage the active community here to flesh out the information. And UPDATE IT. Often things apply to deprecated things.

Im working on a masters in Computer Science now- which is irrelevant except to add weight to the fact that I am not some octogenerian totally unfamiliar with computers- though many concepts here are new to me. (You other classically trained CS people will know that we know all about Java, and Architecture and anything else that was popular in the 90s- but little about the modern web technologies, at least at my tier 1 school. Ive been debating switching to the local regional college-UNC System but Charlotte Campus- because I feel like there might be more practical education there and less theory.

Anyway- I digress. I don’t want to detract from the amazing work done by the people here. ANd writing doc sucks, and you take a ton for granted when you just finished writing a module- you’ll never know it better. And I know rather very little about these web technologies. I am frustrated by how difficult things seem.
Anyway

11 Likes

Amen. This shouldn’t be this trivial.

2 Likes

Where do you add this code?

1 Like

So you put this code into the dashboard Configuration Editor?

Then which card do you use to hold that camera object?

That’s where I’m confused…

1 Like

Hi to all,

I’m posting my experience about home assistant and my Dahua IP cams, connected trough NVR.

I wanted to display on home assistant dash the stream of the front gate and I managed to do it using the ffmpeg built in platform:

On Configuration.yaml I’ve added:

# Front gate cam
camera:
  - platform: ffmpeg
    name: Front Gate Cam
    input: rtsp://admin:[email protected]:554/cam/realmonitor?channel=3&subtype=1

The link above is using the format rtsp://username:pw@ip:port/path-to-stream and is using default password of my NVR and default 554 port for rtsp, after the port number the syntax of the is different from one producer to the other, in my Dahua system I’ve used the IP of the NVR and changing the channel you will change trough the different cams.
The subtype is the stream quality, =0 for main high quality stream, =1 secondary low quality stream.

In my example I’ve used the low quality stream in order to have better loading performances.

After rebooting I’ve added a new card in lovelace, sort by entity and find the new created entity named in my case front gate cam.

This worked perfectly for me, every time I open the mobile app it will refresh the thumbnail of the camera view, and tapping on it will open the streaming. with the stream playing on top right there is the check box “preload stream” that i suggest to reduce loading times of the stream.

I hope this will help someone!

2 Likes

This worked for me too. I’m using an Amcrest camera, but the stream url is identical to this setup. The key was how simple it was to add the stream to my Lovelace UI using @pietro83028 suggested approach:

1 Like