Stream Component: Confirmed Cameras and Configurations

I have a wyze camera flashed with DaFang firmware. I have added the camera component to HA and I am able to get the still image. What do you need to do to see the live stream within HA? If put the RTSP stream in VLC, it works.

This is my configuration

I gave pushing the seek bar forward a try but it hit 5s for a few ticks then drifted back to 15s of delay in chromeā€¦ iOS shows the video as live and the 15s seek does nothing if clicked. This is with preloadā€¦ If I donā€™t have preload set stream is over 30-45s behind when it does load.

Using this at my front door this creates some strange effects as sometimes you see someone walking up the steps to deliver something in the stream but in reality they are already on there way back down or gone or it looks like no one is there yet.

Using the cameras direct native app, or viewing via my synology DS cam app the feed is nearly real-time with only a few frames / 1s delay.

Very sorry, I did not realise that the stream component never successfully installed. I just went through dependency hell, having to install ffmpeg>=3.2 on Ubuntu 16.04, to be able to install the python av library which is a prerequisite for stream to work.

Now that stream is initialising, the camera stream is working fine, actually better than before when the video was proxied. Iā€™d say that the frame rate has vastly improved, maybe even getting close to the 15fps that I configured for my Unifi G3 Flex camera.

I havenā€™t made any changes to the generic camera configuration, nor to the Lovelace card configuration.

When I click on the still image in the card to open the full screen view, I get an entry like this in the HA log:

2019-04-10 13:14:31 INFO (MainThread) [homeassistant.components.stream] Started stream: rtsp://192.168.1.x:7447/0fv5...

I am using Chrome, and looking into the developer tools I can see many consecutive requests to /api/hls/... which are answered with video/mp2t responses. So, Iā€™d say that video streaming is working now.

The delay is inevitable. HLS is not a real time streaming protocol. All it does is break your feed up into little chunks, and sends those over HTTP for your browser to consume. The delay can be reduced by manipulating the ā€œI Frameā€ interval on your cameras if they have the option like my HikVisions do.

I guess where we are in a bit of disagreement is the overall usefulness of the delay. With the MJPEG stream, by the time i got a notification, was able to open the app on my phone, and loaded the camera stream, 99% of the time the subject of interest was gone.

It all depends on perspective. You are welcome to turn the component off and go back to the old method.

1 Like

I have a total of 10 Hikvision cameras via 2 NVRs (one via VPN) and occasionally I see following errors:

Error demuxing stream: No dts in packet
non-existing PPS 4 referenced
log2_max_frame_num_minus4 out of range (0-12): 73
sps_id 8 out of range

here is what Iā€™m seeing notice the still image is current, but when I click on it to start the stream (preloaded) it shows an old segment from 8:06pm last night, and then just spins.

(my Lab is 14.5+ and has a lot of accidents any more soā€¦)

what you are describing sounds similar to my issue that I described here:

if you turn off preload stream on the camera and wait 10 minutes does the video start for you?

The delay can be adjusted by the segment length and playlist size. Could we have these exposed as variables? The big win for me on this component is the ability to cast to my Apple TVs.

A 2 second segment (I believe the smallest recommended) size can result in a 6s delayed stream for example. I wasnā€™t able to dig up what the current segment size and playlist size are currently being used.

We are only reformatting the feed that comes from your camera. We are not transcoding, because that would take way too many resources. All settings need to be adjusted on the feed coming from the camera directly, which is what I said before.

The way the stream component works is it cuts each segment at every keyframe (I-Frame). We do that because of the way h264 encoding works. Each keyframe has the full image, and subsequent frames are just the pixel difference from the keyframe.

Since we are not transcoding, we can not create new keyframes, and therefore can not adjust segment length. Some cameras provide the ability to adjust the interval in which it sends keyframes. That is the only way to reduce the delay at this point in time.

1 Like

never worked after disabling preload and waiting 10+ minutes. HA just hung up and needed a restart.

so you are experiencing the exact same issue described in the bug linked, if you look at my latest comment you can see that I was able to reproduce this by just disconnecting the camera while the stream is up.

Wanscam (at least HW0043 & HW0022) found on eBay works for me.

(Probably a clone of Instar cameras? )
Stated to be ONVIF compliant, but I gave up on that in HA. (Works in other ONVIF apps though)

camera:
  - platform: generic
    name: Cam1
    stream_source: rtsp://<user>:<pass>@<ip>:554/11
    still_image_url: http://<user>:<pass>@<ip>/tmpfs/auto.jpg
    verfy_ssl: false

switch:
  - platform: command_line
    switches:
      cam1_motion_detect:
        command_on: curl "http://<user>:<pass>@<ip>:80/cgi-bin/hi3510/param-cgi?cmd=setmdattr&-enable=1&-name=1"
        command_on: curl "http://<user>:<pass>@<ip>:80/cgi-bin/hi3510/param-cgi?cmd=setmdattr&-enable=0&-name=1"
        command_state: 'curl -k --silent "http://<user>:<pass>@<ip>:80/cgi-bin/hi3510/param-cgi?cmd=getmdattr" | grep "m1_enable" | cut -c 16'
        value_template: '{{ value == "1" }}'

Pretty cool to stream live-ish to CC and AppleTV now as well.

Martin/

Thanks, that is very useful info and was not apparent.

@hunterjm my dafang camera works on my chromecast. However I only get the picture and a white circle spinning at the bottom left.

Its stuck and not even lagging.

Can you please help?

Thanks.

1 Like

this happens to me constantly

I have no sound coming from Blue Iris. Anyone else lacking sound or know how to fix it?

Sound is not supported yet.

2 Likes

Did you hacked the xiaomi dafang camera to make it working with HA? If not, can you share your config?

Iā€™m seeing the same thing. If I click on any of the videos, it starts to spin and then HA becomes unresponsive ā€œUnable to connect to Home Assistant.ā€

Iā€™m running HA in Docker on a Synology NAS with amcrest cameras. I assume the container doesnā€™t have enough resources to handle the load requirement.

What are the minimum specs required for this to work as expected?

I have what is probably a dumb question. Why would someone not want to load the latest version of javascript? in otherwords, why is this not just the default HA process?