2 minute stream delay

I started using the stream component this morning.
The camera’s seem to work, but if I look at the live view of the camera, it has a 1 minute and 52 second delay. Tried multiple camera streams (direct to camera and via synology) but all the same result.

Camera config:

camera:
  - platform: synology
    url: https://[ip]:5001
    username: !secret synology_username
    password: !secret synology_password
    verify_ssl: false
  - platform: generic
    name: carport
    still_image_url: "http://[ip]/cgi-bin/snapshot.cgi"
    stream_source: "rtsp://username:password@[ip]:554/cam/realmonitor?channel=1&subtype=00"
    username: !secret camera_username
    password: !secret camera_password
  - platform: generic
    name: carport_synology_rtsp
    still_image_url: "http://[ip]/cgi-bin/snapshot.cgi"
    stream_source: "rtsp://syno:[token]@[ip]:554/Sms=5.unicast"

picture entity config:

aspect_ratio: 66%
camera_image: camera.carport
camera_view: live
entity: camera.carport
show_name: true
show_state: true
type: picture-entity

Any idea how I can get the live image?

What hardware are you using for home assistant?

I’m running it on an ESXi server with a 10th gen i7 and gave it 8Gb of RAM. M2 SSD as storage.

Ha! Ok, it’s not a pi2 struggling with ffmpeg then.

I hope not :slight_smile:

It’s also very consistent, but with different configs. Not sure what I’m doing wrong.

This is what the webinterface shows if I open it: (of course with the full image above).

Hi @AlphaSupreme! did you tried changing the streaming channel? may be the resolution for streaming in channel ONE is to high, change the channel resolution or change of channel.

like this

"rtsp://username:password@[ip]:554/cam/realmonitor?channel=2&subtype=00"

I had the same problem with a HIKVISION NVR with 45 seconds delay and changing channel to number 2 solved my problem. Now I got 2 or 3 seconds delay almost live :slight_smile:

Let me know if it works.

1 Like

Hi @joaquin68, that helps a lot indeed! Do you have any idea what is causing the delay?
I got it running on a pretty fast system, so I was hoping to be able to stream real-time in a high resolution.

HI @AlphaSupreme thats a great news! Unfortunately I dont have any idea why still have a delay.
Is everything on the same network, is it wired or wifi? If it is wifi, the cost of quality over speed is very high.
May be you should try other channels, enter to the camera config a find wich channel is for example for H264 or mepg and try it.
I have read that the lovelace has a delay for refresh, but i couldnt find it again.

Take a look to this link:

How do I choose the right RTSP protocol to enhance Live View playback quality?

1 Like

I suspect this isn’t the full solution to a problem as big as a 2 minute delay, but choosing the right RTSP protocol fixed things for me. I set the rtsp_transport attribute in the generic camera config.

camera:
  - platform: generic
    name: Side Door
    still_image_url: https://www.google.com/images/branding/googlelogo/2x/googlelogo_color_272x92dp.png
    stream_source: rtsp://<USERNAME>:<PASSWORD>@192.168.2.12:554/chID=1&streamType=main
    rtsp_transport: udp

Prior to making this change, TCP was causing a freeze/pause about once a second, and that would delay the stream longer and longer the more I let the dashboard sit there. After this change, I only have a delay of about 3-5s.