2

While trying to reduce the video latency for a WebRTC communication, I measured the delay between the video capture and the video display.

To prevent measuring latency involved by WebRTC, I just used getUserMedia and an HTML video that displayed the stream.

I did it by displaying a timestamp every frame (using requestAnimationFrame), recording my screen with a USB camera and taking screenshots where both the video display and the displayed timestamp where visible.

On average, I measured a delay of ~150ms. This must be an overestimation (due to requestAnimationFrame time between calls), however the minimum measure I made is around 120ms, that still a lot.

Now, is there a way to reduce this delay between the video capture and the video display ?


Note:

  • I tried using another video lector (window's built-in lector), and the measure were really close (average delay about 145ms)
  • I tried another video device (my laptop webcam with a mirror), and the results are less close but still elevated, on my opinion (average delay about 120ms)
Doreapp
  • 151
  • 6
  • Measure this latency at a variety of video capture frame rates from 5fps to the maximum you can get (possibly 30 or 60fps). The biggest contribution to latency comes from frame times. – O. Jones Jun 21 '21 at 20:34

1 Answers1

2

In general this is something you can only fix in the browser itself.

The requestVideoFrameCallback API is gathering some numbers such as captureTime and renderTime. https://web.dev/requestvideoframecallback-rvfc/ has a pretty good description, https://webrtc.github.io/samples/src/content/peerconnection/per-frame-callback/ visualizes them.

Philipp Hancke
  • 15,855
  • 2
  • 23
  • 31