element-hq / element-call

Group calls powered by Matrix
https://call.element.io
Apache License 2.0
533 stars 84 forks source link

Consider H264 as default codec for video #2373

Open ndren opened 1 month ago

ndren commented 1 month ago

Your use case

What would you like to do?

Replace VP8 with H264 as the default video codec.

Why would you like to do it?

This will reduce the CPU/power consumption and bitrate of video transmission in element call, especially on devices without hardware VP8 encoding/decoding, but also other devices as H264 is well-standardised and optimised as an older standard.

How would you like to achieve it?

Replace this in https://github.com/element-hq/element-call/blob/livekit/src/livekit/options.ts

Have you considered any alternatives?

Keep VP8 or use some other codec.

Additional context

Sending video is the highest difference in CPU usage (2x total usage, from 30% to over 60%) when using element-call for me, receiving video is negligible.

VP8 is not hardware decoded on my laptop according to about:support. I'm almost certain it's not hardware encoded either.

toger5 commented 1 month ago
Looking at: https://livekit.io/webrtc/bitrate-guide - H.264 VP8 VP9 AV1
1920x1080 2.70Mbps 2.00Mbps 1.20Mbps 900kbps
1280x720 1.25Mbps 1.00Mbps 700kbps 550kbps
960x540 700kbps 600kbps 450kbps 350kbps
640x360 400kbps 400kbps 270kbps 190kbps
384x216 170kbps 180kbps 120kbps 90kbps
320x180 140kbps 160kbps 90kbps 70kbps
160x90 50kbps 90kbps 35kbps 30kbps

At the resolutions we are using vp8 is better bandwidth wise then H.264. For lower resolutions it is not however.

Dependent on the hardware h264 might be less resource intensive. Thanks for the ticket so we have a place to discuss this.