Realtime camera streaming without any delay - WebRTC

The bandwidth is only 2mbps…

I haven’t tried this fully as my cameras are temporarily removed due to building work, but just wanted to say @AlexxIT - great job!

This is an issue that’s been a problem in HA for a while now so great news to see there is finally a good solution!

If it ever gets the ability to do 2 way audio then it would really be the ultimate solution to cover even a HA doorbell! :grin:

2 Likes

I think that this add on should be added as build in add on from Home Assistant

1 Like

First of all, I want to mention that I like your wonderful contribution Alexey.
I have 8 cameras active; and as far as I can see in the cards, every camera is immediately live and goes to pause after a click. With 8 cameras it becomes restless and slows down.
Is there an option to start with pause and then have to click (per card) to go to live.

@johnvanl you may discuss this feature here. I’m trying to understand why a user would want to look at a camera that doesn’t work.

Support my feature request!

1 Like

Thank you for this addon! Is it possible to add on the card option for camera TPZ? On my picture-glance card I’m able to put the options to move my camera and it would be great to do the same on this card. Thank you

Refer below link for ptz config

2 Likes

Terrific, it’s working. Thank you very much

Thanks for this. The PTZ works great.

I found that the ptz controls disappear in full screen. Is this normal?

1 Like

@AlexxIT, thank you for this integration! Amazing to see my camera feed on Lovelace with no delay.

In the README.md, it says:
the video will play using MSE. As soon as WebRTC is able to connect - video will play through it, MSE will be stopped.

And in the config, there is an option to disable MSE:
mse: false # disable MSE mode

I disabled MSE mode but when I open Lovelace, the card shows that the camera is still connecting/connects first via MSE (shown by the icon on the upper right) then shifts to WebRTC after ~45 seconds. Is it possible for the connection to go directly to WebRTC?

I’m using a camera with AAC audio codec so sound only works in MSE mode. However, the video is very jumpy in MSE mode so I just want to use WebRTC mode even without audio.

To contribute to the list of working cameras, I can confirm that the Wansview Q6 (PTZ) camera is working with this integration both in WebRTC and MSE mode. Sound is supported in MSE mode only because the camera uses AAC audio codec. I added the camera to HA using the ONVIF integration and then I am able to make the pan and tilt controls work using the following config:

type: 'custom:webrtc-camera'
url: 'rtsp://username:password@cameraipaddress:554/live/ch0' #FHD stream, use ch1 for SD
#entity: camera.your_camera #can also be used instead of url: 'rtsp://username:password@cameraipaddress:554/live/ch0'
ptz:
  service: onvif.ptz
  data_left:
    entity_id: camera.your_camera
    pan: LEFT
    speed: 1
    distance: 0.3
    move_mode: ContinuousMove
  data_right:
    entity_id: camera.your_camera
    pan: RIGHT
    speed: 1
    distance: 0.3
    move_mode: ContinuousMove
  data_up:
    entity_id: camera.your_camera
    tilt: UP
    speed: 1
    distance: 0.3
    move_mode: ContinuousMove
  data_down:
    entity_id: camera.your_camera
    tilt: DOWN
    speed: 1
    distance: 0.3
    move_mode: ContinuousMove

Can’t make the zoom controls work. If anyone knows how to configure the zoom controls, please share. :slightly_smiling_face:

Disabling MSE in master version. Not in release yet. Both tech starts simultaneously. Disabling MSE won’t help start video faster

1 Like

This is what i see on my Galaxy S20 with official Home Asistant app in my home network and external. Video stream is broken. On Xiaomi Redmi Note 8 Pro all is ok. Do you have any idea what’s wrong?

What about bunny video. If it works fine?

Yes, works without problems

Hi @AlexxIT
would it be possible to start streaming video on the card only through a “play” button?

I noticed that when the camera is off (I only turn it on when I am away from home), and I view the card on Home Assistant, WebRTC always tries to view the video and tries to reconnect continuously to the webcam, increasing the CPU usage and consumption.

Even when I close Home Assistant, however, the CPU load remains high compared to when I don’t see the WebRTC card.

Congratulations for the component, it is the only one that shows the rstp video stream in real time with audio listening.

Thank you

Thanks for the info, @AlexxIT.
I’ll probably just return the Wansview Q6 and just get the Sonoff GK-200 camera since it seems to work in WebRTC mode with audio based on @MikeF9 comment.

Hello Alexey !

WebRTC works fine with my 4 cameras (Hikvision, and Annke flashed with an Hikvision firmware).
However I faced the same issues twice this morning when I tried to access the lovelace tab where my cam streams are displayed from my professional laptop. It uses a corporate VPN, I guess that’s the issue.
WebRTC streams did not load, which is not the issue, I expected this result. The problem is that WebRTC process was stuck at 99% on one core of my CPU, even after changing of lovelace tab. The only solution I found was to restart Home Assistant Core.
It happened twice.
I did not take any log, I just restarted to get everything running back ASAP.
But I’m pretty sure I can easily reproduce it.
What would be the best way to capture relevant logs ?

Thanks,
David

Changing Lovelace tab won’t stop connection retries. Only refresh tab stops.

What CPU loading you have when you at home?

When I start HA my CPU average is about 3-4%. When I open the tab with the 4 WebRTC streams, it goes up to 10-15% average.
With the last versions of WebRTC, whenever I don’t use it for some time, it goes down to 7-8% idle.

When I open it from my professional notebook, it increses slowly from 5% to 100%, with WebRTC64 process taking 95% of the CPU.