elad-bar / ha-blueiris

Integration with Blue Iris Video Security Software
184 stars 43 forks source link

Much delay with integration, none when adding camera manually #75

Closed HorizonKane closed 4 years ago

HorizonKane commented 4 years ago

Hi,

I love your integration, it saved me a lot of work.

However, when watching the camera stream in HA, I have a very huge delay of 10 seconds.

Before using your integration, I added the camera like this:

  - platform: mjpeg
    mjpeg_url: http://192.168.83.25:8787/mjpg/Q6-1
    name: Q6-1
    username: !secret bi_username
    password: !secret bi_password
    authentication: basic

and have near to zero delay.

I just tried it again: Removed the integration and added the camera as shown - no delay.

Is there any way to fix this?

elad-bar commented 4 years ago

The component is workinh with h264 stream which BI has a delay of 3 seconds, when working with mjpeg delay is being reduced but you cannot stream it to TV or any other media player, Will add configuration to vhoose which stream type to work with

rodrigoscoelho commented 4 years ago

Great. Needed feature... Thanks


Rodrigo Sírio Coelho

Engenharia / Aimsun

rodrigocoelho@fratar.com.br

Tel: +55 31 4063.6787 - Ramal 234

Cel: +55 31 98489.0807

Em qui., 9 de jul. de 2020 às 11:10, elad-bar notifications@github.com escreveu:

The component is workinh with h264 stream which BI has a delay of 3 seconds, when working with mjpeg delay is being reduced but you cannot stream it to TV or any other media player, Will add configuration to vhoose which stream type to work with

— You are receiving this because you are subscribed to this thread. Reply to this email directly, view it on GitHub https://github.com/elad-bar/ha-blueiris/issues/75#issuecomment-656150608, or unsubscribe https://github.com/notifications/unsubscribe-auth/ABUXTGQ7NKF2TIT2WNZEDZ3R2XFVLANCNFSM4OVTZDNA .

HorizonKane commented 4 years ago

3 seconds would be okay, but it is 10. So I think I will just not stream and use mjpeg after you added it. Thanks for the fast reaction!

One more thing: When I configure the integration in the UI, there are many checkboxes but no text next to them. Is that missing or do I have a problem with my theme or something? :D

elad-bar commented 4 years ago

10 is if you are using also stream component (should be preload stream "heckbox if you are using it), removed that component and got it to 3 sec, Can you pls send me screen shot of the settings ui with the missing labels?

Thanks

HorizonKane commented 4 years ago

After reinstalling the integration, all the labels are there.

Delay remains 10sec with preload stream unchecked.

But I noticed the motion sensor gets no input in HA. The Blue Iris camera is triggering as I also set an MQTT alert for it and the sensot I set up in HA recieves it. But the integrations motion sensor is quiet. Do I need special configuration in BI for that?I guss I have to set up fitting MQTT alerts?

Sorry for messing up different issues here!

elad-bar commented 4 years ago

Please make sure configuration of BI is according to the manual (readme) In addition, please turn off the stream component to get less delay

HorizonKane commented 4 years ago

Okay I oversaw the BI manual link, thank you!

But how do I disable the straem component? You set its the "preload stream" chckbox, but that doesn't change the delay for me.

elad-bar commented 4 years ago

Stream component available in 2 cases:

https://www.home-assistant.io/integrations/stream/

HorizonKane commented 4 years ago

Can't find that in my configuration.yaml and can't remember that I ever used it.

But I got a default_config entry with nothing behind. Should I remove that?

I think being able to switch to mjpeg in the integration would be the best way to overcome this :)

HorizonKane commented 4 years ago

Hi,

sorry for pushing but just want to find out if it makes sense to wait or if I should add the cams manually :)

Are you planning to insert a switch to use mjpeg instad of h264?

elad-bar commented 4 years ago

Probably will get to it during the weekend

HorizonKane commented 4 years ago

Cool, thank you for your effort.

elad-bar commented 4 years ago

Working on that now, will update after I will test it

elad-bar commented 4 years ago

@HorizonKane, added the ability to set the intergation's stream type, please let me know if it works for you

thanks

HorizonKane commented 4 years ago

Hi,

thats great, thank you! Will test it right away tomorrow in the morning :)

HorizonKane commented 4 years ago

Hi,

as soon as I set it to mjpeg, the camera image is not shown anymore. I switched for and backbetween H264 and MJPEG two times: H264 is working, mjpeg not. I also removed my other mjpeg integration of the same camera from my configuration.yaml to see if they intefere, but still no change.

elad-bar commented 4 years ago

Can you extract the url from the camera (using developer -> states) and try accessing the stream url from browser? If it didn't work, Please send the url, In addition, can you try accessing the webui of BI to extract the url from there?

Thanks

HorizonKane commented 4 years ago

In the states I find this:

stream_source: >-
  http://192.168.xx.xx:yyyy/mjpg/Q6-1/video.mjpg?session=<id removed>
still_image_url: >-
  http://192.168.xx.xx:yyyy/image/Q6-1?q=100&s=100&session=<removed>

...

entity_picture: >-
  /api/camera_proxy/camera.blueiris_q6_1?token=<removed>

When I try to access that URL in the browser it asks for authentication but will not accept my user. When I first go to http://192.168.xx.xx:yyyy and authenticate there it is working afterwards in the browser but not in HA.

My working camera where I access the stream is configured like this:

  - platform: mjpeg
    mjpeg_url: http://192.168.xx.xx:yyyy/mjpg/Q6-1
    name: Q6-1
    username: !secret bi_username
    password: !secret bi_password
    authentication: basic

and in states I find this URL:

entity_picture: >-
  /api/camera_proxy/camera.q6_1?token=<removed token>

*updated

HorizonKane commented 4 years ago

Postet wrong cam code, updated

b0ddu commented 4 years ago

I have it working with mjpeg.

On Mon, Jul 20, 2020, 4:52 AM HorizonKane notifications@github.com wrote:

Hi,

as soon as I set it to mjpeg, the camera image is not shown anymore. I switched for and backbetween H264 and MJPEG two times: H264 is working, mjpeg not. I also removed my other mjpeg integration of the same camera from my configuration.yaml to see if they intefere, but still no change.

— You are receiving this because you are subscribed to this thread. Reply to this email directly, view it on GitHub https://github.com/elad-bar/ha-blueiris/issues/75#issuecomment-660895528, or unsubscribe https://github.com/notifications/unsubscribe-auth/AKNIEK6VAMUSQ7NZXZ3CJOTR4QATTANCNFSM4OVTZDNA .

HorizonKane commented 4 years ago

I just see the loading circle forever on mjpeg though the integration.

elad-bar commented 4 years ago

Loading circle it means that you work with stream: component, the problem with that component is that it overloads the BI server that cannot retrieve the stream

Regarding the attributes, there ahould be full path to the bi server's stream can you check if it accessible from browser

HorizonKane commented 4 years ago

I checked that, see 4 posts above.

The server can't be overloaded, it has plenty of resources and only one cam added. Also mjpeg stream from BI is running fine with the camera I manually configured. Can I check something else?

elad-bar commented 4 years ago

Can you please post the attributes of the camera created by BI integration? I would like to compare it to the manual camera you'be set up above, It should include 2 specific attributes- still image and stream source as full path to the BI server

Thanks

HorizonKane commented 4 years ago

I am confused a little bit, I think the exact information you are asking for is in the upper post. On the top you find the still image URL, stream URL and entity picture from the states like you asked for.

In the second two code boxes you find the information from the working BI camera I configured manually including stream URL.

Ich you are asking for the YAML created by the plugin for the BI cameras, I don't have that as config file creation is not working.

elad-bar commented 4 years ago

Sorry, missed that part 😃 ... So the issue is authentication, can you post a screenshot of webserver configuration, I would like to define mine the same to check it or suggest you to switch to same as mine iv you would like

HorizonKane commented 4 years ago

Sure, here you go. But what I dont understand at all: It is instantly working when I switch to H264 - so can it really be an authentication problem?

image

Ignore the no signals, they are just powered off :) The cam in question is running of course.

elad-bar commented 4 years ago

I'm using secure session key, and only for non internal network (but that all connections is not that problem), I will remove that checkbox on mine later and get back to you

Thanks

HorizonKane commented 4 years ago

Okay I see.

I am willing to change those options if necessary. I could also exclude LAN from the need to authenticate. Will wait for your findings, thank you.

HorizonKane commented 4 years ago

No change when I switch those options.

HorizonKane commented 4 years ago

Did you notice that when I integrate the camera manually, I dont define a stram_url at all, I just give the parameter mjpeg_picture. I also don't see a stream_source in my states there but it is working.

HorizonKane commented 4 years ago

Hi,

any news? Is there anything else I can check to help figure this out?

HorizonKane commented 4 years ago

I have it working with mjpeg. On Mon, Jul 20, 2020, 4:52 AM HorizonKane @.***> wrote: Hi, as soon as I set it to mjpeg, the camera image is not shown anymore. I switched for and backbetween H264 and MJPEG two times: H264 is working, mjpeg not. I also removed my other mjpeg integration of the same camera from my configuration.yaml to see if they intefere, but still no change. — You are receiving this because you are subscribed to this thread. Reply to this email directly, view it on GitHub <#75 (comment)>, or unsubscribe https://github.com/notifications/unsubscribe-auth/AKNIEK6VAMUSQ7NZXZ3CJOTR4QATTANCNFSM4OVTZDNA .

Would you mind to share your BI (webserver) settings? I tried elads and played aroud a lot but still no positive result with mjpeg.

elad-bar commented 4 years ago

Will try to get to it later today

HorizonKane commented 4 years ago

Thank you. Let me know if I can deliver any helpful information.

And just as a site note: Everything else is working (camera connection, motion detection, h264... it is only the stream not shown and only on mjpeg option).

elad-bar commented 4 years ago

image

HorizonKane commented 4 years ago

Thats like I tried it, too. I can also access the stream url from the state without problems and my manually configured mjpeg cam is working. When I switch your integration back to H264 its working (with 10sec delay) but as soon as I go back to mjpeg I get only the circle again.

elad-bar commented 4 years ago

@HorizonKane so just to understand, 10 days ago you've mentioned the 2 links to get to the camera, one of them is without the BI component - manual setup of camera using the following path: http://192.168.xx.xx:yyyy/mjpg/Q6-1

while BI component is generating the following path: http://192.168.xx.xx:yyyy/mjpg/Q6-1/video.mjpg?session=

the second path is not being loaded by the stream component of HA while the first one does

did I get it correct? asking to understand if that's the scenario I need to run locally

HorizonKane commented 4 years ago

I will just post you what I actually see now.

The camera from your integration, with mjpeg as format looks like this in states:

access_token: <some token>
friendly_name: BlueIris Q6-1
stream_source: >-
  http://192.168.xx.xx:yyyy/mjpg/Q6-1/video.mjpg?session=<some session>
still_image_url: >-
  http://192.168.xx.xx:yyyy/image/Q6-1?q=100&s=100&session=<some session>
name: Q6-1
id: Q6-1
FPS: 14.97
Audio support: true
Width: 1920
Height: 1080
Is Online: true
Is Recording: false
Issue: false
'Alerts #': 0
'Triggers #': 0
'Clips #': 0
'No Signal #': 810
Error: ''
entity_picture: >-
  /api/camera_proxy/camera.blueiris_q6_1?token=<some token>
supported_features: 2

When I copy the stream_source URL to my browser I get the live picture right away.

The (same) camera I configured myself looks like this in the states:

access_token: <some token>
friendly_name: Q6-1
entity_picture: >-
  /api/camera_proxy/camera.q6_1?token=<some token>
supported_features: 0

and like this in configuration.yaml:

camera:
  - platform: mjpeg
    mjpeg_url: http://192.168.xx.xx:yyyy/mjpg/Q6-1
    name: Q6-1
    username: !secret bi_username
    password: !secret bi_password
    authentication: basic

The second one is loading, the one from the integration not:

image image

elad-bar commented 4 years ago

Ok, found the issue, component is using the basic camera with implementation of Generic IP Camera, since it works with Stream component you have the delay, the camera you've set up is MJPEG camera which is not working with Stream component.

I need to add the support for MJPEG camera implementation in case configuration is for MJPEG, otherwise, it will work with Generic IP Camera.

Will update later this weekend about progress

thanks

HorizonKane commented 4 years ago

Cool.

Thank you for your continued effort!! Really appreciate the work you and others do to make such stuff available to others.

Rodrigodg6 commented 4 years ago

Em sex, 10 de jul de 2020 01:31, elad-bar notifications@github.com escreveu:

Please make sure configuration of BI is according to the manual (readme) In addition, please turn off the stream component to get less delay

— You are receiving this because you are subscribed to this thread. Reply to this email directly, view it on GitHub https://github.com/elad-bar/ha-blueiris/issues/75#issuecomment-656476234, or unsubscribe https://github.com/notifications/unsubscribe-auth/AQGJXZIFDZN5P4PVFLPIALTR22KRJANCNFSM4OVTZDNA .

elad-bar commented 4 years ago

released new version, please let me know if now it works out of the box for you

thanks

Implemented enhancements:

HorizonKane commented 4 years ago

Seems to be working like a charm now :) Thank you!!!

elad-bar commented 4 years ago

Great! Thanks