Problem

  • Displaying live video feed from the Dahua camera / NVR in a home assistant dashboard.
  • Using the Dahua integration and the WebRTC card (custom:webrtc-camera).
  • The video is delayed or freezes, the “MSE mode” label is displayed in the corner.

Solution

Disable the MSE mode fallback in the WebRTC card, add

mode: webrtc

to the card configuration so that it looks like this:

              - type: custom:webrtc-camera
                entity: camera.my_camera_sub
                mode: webrtc

Now, if WebRTC connection is not possible, the card will show an error. If the error is

webrtc:/offer: streams: codecs not matched: error H265 => VP8, VP9, H264, AV1, OPUS, G722, PCMU, PCMA, S16B, S16L

it means that the Dahua camera/NVER encodes the stream using the H.265 codec, while the WebRTC in this particular browser supports only H.264. The solution is to change the stream encoding in Dahua settings to H.264. Please note that if the sub stream is used (which is probably a good choice for live view, as it is smaller), then sub stream settings should be adjusted, not the main one.