Problem with stream component setup

Haha, it’s evening here as well neighbor (Netherlands here). Well have a nice evening, if you ever run into trouble just ask and I will try to answer it, but like most people I do not have the answer to all questions haha.

@WolfsW3lp3 one last question, did you get the stream setup working? As this was the original question in this thread?

Yes stream setup worked perfectly :smiley:
But I ran into another problem with streaming my cameras (RTSP Streams not working anymore)
https://pastebin.com/fNg9ZYsU

Unauthorized is not true the login credentials are correct!

Hm unfortunately I am not so good with this stuff. I assume you installed the dependencies I posted earlier? (The long string from several posts ago). Might try restarting the camera’s (or software if you use something like zoneminder or blueiris) and restart HA just to be sure. Oh and make sure your HA instance has local network access, but I assume this is working as everything else is working for you.

Edit: to be really sure it isn’t something else you could test the camera stream in vlc or other software just to be sure that the stream is reachable. Alternatively, if you did not expose the camera to the internet directly, you could try to remove the user/pwd and try again. Personally I would let HA manage the camera and not expose the rtsp port to the internet.

Yes I executed the long string ^^

Wow I had the exact same idea with VLC ^^ (Restaring the camera right now because VLC cant get a connection with rtsp but the webinterface still works, strange ^^)
No the camera has no internet connecting only locally!
Nobody can use the rtsp port so you don’t have to worry about it because every port gets blocked by my router.

I will get in touch later if I found out something.

Well it was a common problem I had, the stream would be unreachable for some reason, or would be reachable but only the webinterface like you said. Or it would just give a black screen. For me most of the times a camera restart would fix it. Though there are so many different camera’s that I can’t possibly tell if yours would work the same way or not.

Though, I do know that not every camera is supported in the stream component. There is a list somewhere of all camera’s that are supported. Will try to find it later.

Ehm ok…
I tried to change the rtsp url of the camera and saved the configuration.
Now HA telling me that:

Unable to read file /home/ha/.homeassistant/configuration.yaml: ‘utf-8’ codec can’t decode byte 0xfc in position 2762: invalid start byte

Edit:
Removed all cameras for now and the error disappeared.
I dont know why :frowning:

Edit 2:
Ok I think I am a little bit stupid ^^ Saved it in the wrong translation

Could you post your configuration? Configuration.yaml and the camera config? Maybe I can find something there. Did VLC work at least?

Edit: also mention which camera you use plz.

Yeah VLC worked

This is my config:
https://pastebin.com/1WzV3Swp
The Camera I use is the Mobotix T25

Edit: Sorry for late answer. I tried to fix it by my own but nothing worked :frowning:
A few tries removed the error but the stream buffering and buffering.
Debug Message:

2019-05-29 22:18:46 INFO (MainThread) [homeassistant.components.stream] Started stream: rtsp://user:[email protected]:1348/stream0/mobotix.mjpeg

Ok, I have checked some stuff for you, and there are some lines that I have some doubts about.

First of all, I see that you have put ffmpeg: in your configuration.yaml file. I am not entirely sure if you would really need this (I don’t have it and it works perfectly fine).

Second, you have 2 camera’s right? The first one is a mjpeg one, this is not supported in stream, only generic camera is supported for streams. You can still stream when clicking on the image but it is not the same as the rtsp stream. (I have a usb cam which can’t do rtsp either, so no stream available other than what was already possible for a long time).

The second cam you have setup is a generic camera which might work. Though it isn’t listed in the supported camera’s list as far as I can see:
Stream Component: Confirmed Cameras and Configurations - You can check here when your camera gets added.

I myself have a xiaomi cam with dafang hacks and the configuration looks like this:

  - platform: generic
    stream_source: rtsp://192.168.0.75:8554/unicast
    still_image_url: https://192.168.0.75/cgi-bin/currentpic.cgi
    name: Gallerij Camera
    verify_ssl: false
    username: !secret xiaofang_usr
    password: !secret xiaofang_pwd

For the mobotix cam you will indeed have a longer string (so do not copy my setup) with the user/pwd in the address of the stream rtsp://user:[email protected]:1348/stream0/mobotix.mjpeg (obviously I copied this from your post and you should not use this again).
What I can see is that you have setup a max fps, I believe this is no longer supported and you would do right by removing that entire line. (it should say that in the logs as well but couldn’t find it, something in the lines of “extra keys not allowed”).
After fixing that line, you should check the stream url which usually shouldn’t end in a file extension (I don’t know about your specific camera, but most camera’s I have seen only use the extension for images, like you can see in my example)

I have found this site which I have used for all my camera’s in the past to find the right url for rtsp streams:
https://www.ispyconnect.com/man.aspx?n=mobotix&page=1 - I happen to have found the right page for your cam if I am correct. Try the example given on that page (add your username/pwd and ofc change the ip address). If all is good it might work. I say might as it is not on the confirmed list. Let me know what your results are.

Edit: Try other url’s from that page if it doesn’t work, sometimes it will accept other url’s depending on firmware, region etc.

I guess no longer an issue for you, but which version of Ubuntu are you running? Versions older that 18.04 LTS dont install a usable version of ffmpeg - https://docs.mikeboers.com/pyav/develop/installation.html

@walaj I actually have this version:

Distributor ID: Ubuntu
Description: Ubuntu 18.04.2 LTS
Release: 18.04
Codename: bionic

@jimz011 I tried a few things but nothing really worked.
The page you told me only showing examples for http stream. I tried a few, but nothing worked, I received this error:

2019-05-30 10:19:05 INFO (MainThread) [homeassistant.components.stream] Started stream: http://us:[email protected]/control/faststream.jpg?stream=full
2019-05-30 10:19:07 ERROR (stream_worker) [libav.mpjpeg] Expected boundary ‘–’ not found, instead found a line of 127 bytes
2019-05-30 10:19:07 ERROR (stream_worker) [homeassistant.components.stream.worker] Error demuxing stream: No dts in packet

The HTTP and RTSP Stream is working in VLC but I read that when UDP Stream is not working VLC falls back for TCP Stream and maybe stream: component only supports UDP Streams is that possible ? I understand not quite much of these things so its only a thought.

Edit: I did a little workaround! I involved BlueIris running on the Windows Server. BI receives the different streams, so i can access the camera streams with BI’s built in Webserver. Now I have my camera in Home Assistant + support Camera preload and recording :smiley: (even for the MJPEG camera)
But I have a delay up to 20s, which is too much. :confused:

Edit 2: I discovered a little inconspicuous error, maybe it sticks together with the delay ?

2019-05-30 13:37:10 ERROR (stream_worker) [libav.AVBSFContext] Invalid NAL unit 0, skipping.