Stream Component: Confirmed Cameras and Configurations

This is what I got and still it just does nothing but a spiral loading.

camera:
  #- platform: ffmpeg
    #input: rtsp://10.0.0.555:554/ch01/1
    #name: "Front Cam"
  #- platform: ffmpeg
    #input: rtsp://10.0.0.555:554/ch02/1
    #name: "Road Cam"
  #- platform: ffmpeg
    #input: rtsp://10.0.0.555:554/ch03/1
    #name: "Back Cam"
  - platform: generic
    name: "Front Cam"
    still_image_url: http://10.0.0.555/jpg/image.jpg
    stream_source: rtsp://10.0.0.555:554/ch01/1
  - platform: generic
    name: "Road Cam"
    still_image_url: http://10.0.0.555/jpg/image.jpg
    stream_source: rtsp://10.0.0.555:554/ch02/1
  - platform: generic
    name: "Back Cam"
    still_image_url: http://10.0.0.555/jpg/image.jpg
    stream_source: rtsp://10.0.0.555:554/ch03/1  

#ffmpeg:

stream:

Does it work in Lovelace without stream: enabled? If yes , then config is correct, if it doesnā€™t work with stream in your config, then maybe camera is just not supportedā€¦

Took the stream out of my config and it doesnā€™t work. So I guess I am out of luck. I just thought that if I had got an ip camera it would have been enough to get set up in home assistant. Thanks for your help anyway.

What ip cam do you have? Try to install vlc player, much easier to test streams

Oh it works fine with vlc with this url: rtsp://10.x.x.xxx:554/ch01/1

Should also work then in haā€¦

Then I must be entering something wrong but I just donā€™t know what it is. I use the same ip address that I use in vlc, but nothing works.

You may need more details added in your config.
Do you need authentication?
SSL?
Check the generic cam docs again and look at all the options.
When I set my cams up I had to do trial and error to see what HA needed to see the streams.
Just because it works in vlc doesnā€™t mean you have the whole config right in HA.

1 Like

not sure if its normal, but the only issue i have is that my streams are like 10 secs behindā€¦
iif i open the streams in VLC, that its all normal

any idea what can be the cause?

I tried username, password, authentication, verify ssl and still no result. I played around with the different selections and I still just get the spiral loading.

I use all four of those to get mine to work.
Did you try both digest and basic authentication? I just remembered that one of my cams wouldnā€™t work with digest. Had to use basic for that one. Probably an older firmware.

Yes I tried digest and nothing then I put it back to basic.

The only thing I am not sure about is the still image url. I donā€™t know if I got that right or if it would affect the outcome if itā€™s incorrect.

Iā€™m trying to set a pair of Dahua cameras to show in HA but I have no joy. Iā€™m getting 401 unauthorised, I tried playing with authentication and verify_ssl but no matter what combination I tried Iā€™m getting the same message. If I use the the rtsp link in VLC the stream is perfect.

Any ideas?

camera:
  - platform: generic
    still_image_url: !secret frontdoor_camera_still
    stream_source: !secret frontdoor_camera_stream
    username: !secret camera_username
    password: !secret camera_password
    name: FrontDoor
    #authentication: basic
    verify_ssl: false
  - platform: generic
    still_image_url: !secret kitchen_camera_still
    stream_source: !secret kitchen_camera_stream
    username: !secret camera_username
    password: !secret camera_password
    name: Kitchen
    #authentication: basic
    verify_ssl: false

Try not with username and password as separate, include it in your stream urls

Thanks for the pointers Fabio. I have commented the username and password in my configuration and tried all options with authentication and ssl but getting the same error.

The error from the log file can be found below (I redacted the username and password from the below error log).
Could it be that my password contains special characters thatā€™s causing the problem :thinking:

2019-11-26 07:36:40 ERROR (stream_worker) [libav.rtsp] method OPTIONS failed: 401 Unauthorized                                                                                    
Exception in thread stream_worker:                                                                                                                                                
Traceback (most recent call last):                                                                                                                                                
  File "/usr/local/lib/python3.7/threading.py", line 926, in _bootstrap_inner                                                                                                     
    self.run()                                                                                                                                                                    
  File "/usr/local/lib/python3.7/threading.py", line 870, in run                                                                                                                  
    self._target(*self._args, **self._kwargs)                                                                                                                                     
  File "/usr/src/homeassistant/homeassistant/components/stream/worker.py", line 49, in stream_worker                                                                              
    container = av.open(stream.source, options=stream.options)                                                                                                                    
  File "av/container/core.pyx", line 275, in av.container.core.open                                                                                                               
  File "av/container/core.pyx", line 227, in av.container.core.Container.__cinit__                                                                                                
  File "av/container/core.pyx", line 129, in av.container.core.ContainerProxy.__init__
  File "av/container/core.pyx", line 195, in av.container.core.ContainerProxy.err_check                                                                                           
  File "av/utils.pyx", line 105, in av.utils.err_check                                                                                                                            
av.AVError: [Errno 825242872] Server returned 401 Unauthorized (authorization failed): 'rtsp://username:[email protected]:554/cam/realmonitor?channel=1&subtype=0' (
16: rtsp)

Does it work if you use that url string in vlc ?

Yes, see my original post. If I get the URL and paste it in VLC the stream is fine.

what plugin did you use ?

Not sure then, in my case it worked when I used user and pass in the string