As chrome or chromium browser does not support hardware accelerated video decoding for Linux OS. Though there is a pending PR in chromium repository to merge but google has no plan to merge it.
Due to software base approach for GPU activity , electron app performance might be affected in Linux environment. But by installing some driver for Linux and passing flag in chromium can enable hardware accelerated activity in electron app. Lets start with the steps to enable hardware acceleration in electron app for Linux OS (Mainly ubuntu):
Check weather hardware accelerated activity is supported in currently.
Open chrome developer console put the following code.
window.location.replace("chrome://gpu");
This page should following if not supported.
Driver Installation:
PC running the electron app must have following driver install on the system. ` libva-glx2 , libva-x11-2, i965-va-driver chromium-codecs-ffmpeg-extra, libgl1-mesa-glx`
sudo apt install libva-glx2 \
libva-x11-2 i965-va-driver chromium-codecs-ffmpeg-extra libgl1-mesa-glx
Adding flags while running electron app.
In you package json, you can change start script with following:
Before:
"start":"electron ."
To:
"start": "electron --enable-accelerated-mjpeg-decode --enable-accelerated-video --ignore-gpu-blacklist --enable-native-gpu-memory-buffers --enable-gpu-rasterization ."