Performance Discrepancy: Direct getDisplayMedia vs. Canvas Capture for 2K Screen Sharing (OpenH264 )

40 views
Skip to first unread message

xuanshu wu

unread,
Jun 10, 2025, 12:44:28 PMJun 10
to discuss-webrtc

Hi all,

I encountered a performance issue with 2K screen sharing using openH264 encoding and would appreciate your insights.


Test Setup:

  • Source: 2K display capture via getDisplayMedia().

  • Test URL: https://sh7mzr.csb.app/

  • Encoding: OpenH264 (video/H264 level-asymmetry-allowed=1;packetization-mode=1;profile-level-id=42e01f ).


Results:

  1. getDisplayMedia → PeerConnection:

    • Encode time: ~500ms

    • Frame rate: 1–2 FPS

    • withoutCaptureStream.jpeg

  2. getDisplayMedia → canvas.captureStream() →  PeerConnection:

    • Encode time: ~20ms

    • Frame rate: ~30 FPS

    • withCaptureStream.jpeg

Is this behavior expected? If so, why does routing through a canvas dramatically improve encoding performance for 2K content?

My hypotheses: Could GPU rasterization of the canvas bypass CPU bottlenecks?
Reply all
Reply to author
Forward
0 new messages