teams-for-linux
teams-for-linux copied to clipboard
Possible guide to enable HW DEcoding and ENcoding in electron
From using teams4linux daily i notice my laptop goes into turbo mode whenever i enter a call and everyone turns on their cameras (and I have to turn on mine) The teams v2 has a call health feature and displays that the videos are decrypted using SW.
Looking to solve my issue, i tried to force enable HW encoding on chromium. Managed to do it but my video comes out with artifacts... But the performance improved.
So I found this repo: https://github.com/StaZhu/enable-chromium-hevc-hardware-decoding which may help to enable HW encoding/decoding in electron. I know it talks about hevc and teams uses h264, but there might something that helps enabling both.
For reference, my work laptop is running Pop!_OS 22.04 on a i7-10610U
You should be able to use the ['enable-features', 'PlatformHEVCDecoderSupport'] like in https://github.com/IsmaelMartinez/teams-for-linux/tree/develop/app/config#electron-cli-flags . I haven't test it but that would enable that flag as described in https://github.com/electron/electron/issues/35392 . We use electron 29 (Just upgraded to 30 today) so this should be well supported.
Thanks for the link and the info!
Thanks for the config option, but so far I tried several flags, including the ones I use to make it work on chromium, and I still get SW video processing on Teams for linux
Here's the config I tried for reference:
"electronCLIFlags":[ ["ignore-gpu-blocklist"], ["enable-zero-copy"], ["enable-features", "WebRTCPipeWireCapturer,PlatformHEVCDecoderSupport,CanvasOopRasterization,VaapiIgnoreDriverChecks,VaapiVideoDecoder,VaapiVideoEnco> ["enable-accelerated-video-decode"], ["disable-features","UseChromeOSDirectVideoDecoder"] ]
Hi! I'm also pursuing this feature, and I think there has been a mistake pasting the configuration, I think you meant:
"electronCLIFlags": [
["ignore-gpu-blocklist"],
["enable-zero-copy"],
["enable-features", "WebRTCPipeWireCapturer,PlatformHEVCDecoderSupport,CanvasOopRasterization,VaapiIgnoreDriverChecks,VaapiVideoDecoder,VaapiVideoEncoder"],
["enable-accelerated-video-decode"],
["disable-features","UseChromeOSDirectVideoDecoder"]
]
right?
Also, in order to check if GPU decoding is enabled I'd like to follow these troubleshoot steps but I don't know how to get there in the t4l window. Hints appreciated ;)
Hi! I'm also pursuing this feature, and I think there has been a mistake pasting the configuration, I think you meant:
"electronCLIFlags": [ ["ignore-gpu-blocklist"], ["enable-zero-copy"], ["enable-features", "WebRTCPipeWireCapturer,PlatformHEVCDecoderSupport,CanvasOopRasterization,VaapiIgnoreDriverChecks,VaapiVideoDecoder,VaapiVideoEncoder"], ["enable-accelerated-video-decode"], ["disable-features","UseChromeOSDirectVideoDecoder"] ]right?
Also, in order to check if GPU decoding is enabled I'd like to follow these troubleshoot steps but I don't know how to get there in the t4l window. Hints appreciated ;)
yes! i copied from the nano windows and missed also the VaapiVideoDecodeLinuxGL feature flag I also dont know how to open the chrome:gpu window
I wonder if it is worth opening an issue/question in the electron repository. Maybe some of those flags aren't supported. Or check on running from source (check the contributing.md file). Maybe is the bundling that is blocking some areas... but I would suspect is electron land issue/limitation.
I'm also still struggling with this (as reported in https://github.com/IsmaelMartinez/teams-for-linux/issues/1246). Teams pair programming on that particular laptop (ThinkPad X1C 8th Gen) is a punishment.
My current settings are essentially the same as other's above:
~/.config/teams-for-linux/config.json
{
"electronCLIFlags": [
["ignore-gpu-blocklist"],
["enable-zero-copy"],
["enable-accelerated-video-decode"],
["enable-features", "WebRTCPipeWireCapturer,PlatformHEVCDecoderSupport,CanvasOopRasterization,VaapiIgnoreDriverChecks,VaapiVideoDecoder,VaapiVideoEncoder,VaapiVideoDecodeLinuxGL"],
["disable-features","UseChromeOSDirectVideoDecoder"]
]
}
How can I check if these settings even get consumed?
...
Now... to get a bit off of Ismael's back, I have to admit I'm apparently struggling with basic Chromium acceleration already.
When launching the browser with
chromium-browser --ignore-gpu-blocklist --enable-zero-copy --enable-accelerated-video-decode --enable-features=WebRTCPipeWireCapturer,PlatformHEVCDecoderSupport,CanvasOopRasterization,VaapiIgnoreDriverChecks,VaapiVideoDecoder,VaapiVideoEncoder,VaapiVideoDecodeLinuxGL --disable-features=UseChromeOSDirectVideoDecoder
And checking about:gpu, I get two promising sections:
Which means I can't hardware-decode AV1, YouTube's default for most videos, but I can force H264 with the h264ify extension (which works correctly, checking "stats for nerds"). Yet despite what the images above might imply, intel_gpu_top shows no bar for the video line when playing a H264 video, and there is massive CPU usage.
It does use video in Firefox and mpv, with nicer CPU usage, so my hardware & OS can in fact accelerate the decoding.
Chromium 101.0.4951.15 on Ubuntu 22.04.4 can't.
I don't want to derail this too much, but can anyone reproduce this underlying issue?
have you check in the electron issues https://github.com/electron/electron/issues ? This might be something other users of electron have experienced. Hopefully something in there helps you. Sorry
I think HW processing is now enabled for me with the electronCLIFlags config option suggested above (Intel Alder Lake iGPU). I noticed that it only worked with no effects enabled and reverted back to SW processing when I enabled the blur effect.
This issue is stale because it has been open 30 days with no activity. Remove stale label or comment or this will be closed in 5 days.
This issue is stale because it has been open 30 days with no activity. Remove stale label or comment or this will be closed in 5 days.
This issue was closed because it has been stalled for 5 days with no activity.
Still cannot be resolved
so, i am currently trying to get hardware acceleration working under ubuntu 24.04 + gnome + wayland with a 7840u.
running chrome from the command-line:
google-chrome --use-gl=angle --use-angle=vulkan \ --enable-features=AcceleratedVideoEncoder,VaapiOnNvidiaGPUs,VaapiIgnoreDriverChecks,Vulkan,DefaultANGLEVulkan,VulkanFromANGLE \ --ignore-gpu-blocklist --disable-gpu-driver-bug-workaround
results in about:gpu showing hardware accel for encode / decode and the resource monitor shows a video encoder/decode usage of about 6/7%.
setting those same flags in config.json seems to have no effect for teams-for-linux, which is not completely unexpected, as electron does not support those flags: https://www.electronjs.org/docs/latest/api/command-line-switches
but i might be missing something... ;-)
This has been broken for me for the past few months despite working some time ago. I'm not sure what changed but my guess would be something in electron.
{
"electronCLIFlags": [
["use-gl", "angle"],
["use-angle", "vulkan"],
["enable-features", "AcceleratedVideoEncoder,VaapiOnNvidiaGPUs,VaapiIgnoreDriverChecks,Vulkan,DefaultANGLEVulkan,VulkanFromANGLE"],
"ignore-gpu-blocklist",
"disable-gpu-driver-bug-workaround"
]
}
after fixing some typo, this seems to result in encoder/decoder being used. though video appears to freeze sometimes...
{ "electronCLIFlags": [ ["use-gl", "angle"], ["use-angle", "vulkan"], ["enable-features", "AcceleratedVideoEncoder,VaapiOnNvidiaGPUs,VaapiIgnoreDriverChecks,Vulkan,DefaultANGLEVulkan,VulkanFromANGLE"], "ignore-gpu-blocklist", "disable-gpu-driver-bug-workaround" ] }
after fixing some typo, this seems to result in encoder/decoder being used. though video appears to freeze sometimes...
Thanks, this worked for me to get HW video processing working (I removed VaapiOnNvidiaGPUs since I don't have an Nvidia GPU).
Thanks, this worked for me to get HW video processing working
How did you verify that ?
OK, I re-read the first message here - you can verify that in three dots -> Settings -> Call health when on a call