balena-electronjs icon indicating copy to clipboard operation
balena-electronjs copied to clipboard

Video performance

Open manast opened this issue 7 years ago • 18 comments

Hello,

I have been checking resin-electronjs today and I am not able to get any decent performance on a raspberry pi 3. I have tried with the master branch as well as with the framebuffer one. Also, I noticed that the image quality is not so good, it seems as if the graphics are quantized, i.e. running in maybe 16bits/pixel instead of 24. Do you have any advices? is it even possible to get an acceptable performance to play videos using electron on a rpi?

manast avatar Sep 12 '16 15:09 manast

I have attempted to get this working, unfortunately chromium (on which electron is based) does not support the GPU used in the RPi, this means that it is unable to use hardware acceleration and the full load is dumped onto the CPU, which does not handle video decoding very well.

mrjonny2 avatar Sep 30 '16 10:09 mrjonny2

maybe by activating WebGL but don't know how to do that within a resin image ?

buildog avatar Oct 25 '16 17:10 buildog

This is actually my main use case for wanting to buy a raspberry pi: An electron app meant for video playback.

bitnom avatar Jan 12 '17 02:01 bitnom

@TomAshley303 In my experience, until they update to the 4.4 kernel which has the (experimental) OpenGL support you will pretty much HAVE to rely on omxplayer for video playback. I know the resin team is working on the update as we speak. For now, I am running an electron app based on this template and then triggering videos via omx-manager. I just send button presses/states through the electron IPC from the renderer to the main. Also, since you can set a window size for the omxplayer instance, I just overlay the video on PART of the ui and then you can still use button presses on the page to control the video.

danielmahon avatar Jan 12 '17 03:01 danielmahon

Hi, any updates on OpenGL support?

IvanTorresEdge avatar Aug 24 '17 10:08 IvanTorresEdge

It seems to be on chromium's side with a lack of support for mali GPUs on linux

mrjonny2 avatar Aug 30 '17 03:08 mrjonny2

I know the resin team is working on the update as we speak

@danielmahon Do you know anything about the progress on the Resin team side?

kristjanmik avatar Oct 02 '17 15:10 kristjanmik

Hello, it turns out the issue is with the mesa libraries that are installed by debian:jessie. The way to fix this is to update these packages. To do that add the jessie-backports mirror to your source.list file, by adding the following line to your Dockerfile: RUN echo "deb http://ftp.debian.org/debian jessie-backports main" >> /etc/apt/sources.list Lastly use apt-get with -t jessie-backports flag to install from that source: apt-get -t jessie-backports install {packages}

more info here https://github.com/resin-os/resin-up-board/issues/26

curcuz avatar Oct 02 '17 16:10 curcuz

Sorry, that is related to Intel based devices, while this thread is about the rpi3 - my fault :/ On the rpi side, the issue is on chromium and I don't see a fix coming soon. Even if it does, it needs to hit chromium, than electron, then this project. If you are interested only in running web content with hw acceleration this project from @petrosagg does it very well https://github.com/resin-io-playground/resin-wpe

curcuz avatar Oct 02 '17 16:10 curcuz

@curcuz Thanks for the quick reply. This only works on Intel based boards, not the Raspberry Pi 3(which is ARM based). Is there any solution that you know of for ARM based devices?

kristjanmik avatar Oct 03 '17 13:10 kristjanmik

I need this working too... Is there anything?

MiluchOK avatar Oct 26 '17 06:10 MiluchOK

Maybe someone with enough experience in building electron/chromium could apply one of these patches and build a custom electron binary for the rpi: https://github.com/raspberrypi-ui/chromium_patches The Chromium version shipped in the latest raspbian releases has one of these patches applied and plays 1080p H264 just fine. Sadly it crashes when using the OpenGL driver, so either you have accelerated video OR accelerated animations and webgl.

SteffenDE avatar Jan 03 '18 23:01 SteffenDE

Adding dtoverlay=vc4-fkms-v3d into config.txt helped with WebGL/CSS HW performance on Raspberry Pi 3.

apgiorgi avatar Jan 09 '18 16:01 apgiorgi

i'm experiencing the same problems with the rpi3 using the video tag and a 1080p mp4 video.

omxplayer does a decent job and the playback is flawless. but since i want an overlay (text, images, ..) on top of the video, omxplayer won't work for me - omxplayer OR html content :/

does someone know if another board is capable of smooth 1080p video playback using the html5 video tag? what about the intel nuc? thanks!

Addflow avatar Aug 15 '18 13:08 Addflow

@Addflow I‘m using a Celeron NUC with Ubuntu 16.04 and Chromium and it plays 1080p H264 fine.

SteffenDE avatar Aug 15 '18 19:08 SteffenDE

Has chromium fixed this yet? Is it a problem with chromium?

cyraid avatar Dec 05 '18 21:12 cyraid

I'm trying to solve this, too. Adding dtoverlay=vc4-fkms-v3d did help considerably, but not enough for 1080p.

I briefly tried to use omxplayer, but battled to install it. @danielmahon can you share how you went about using omxplayer?

nicshackle avatar Mar 25 '19 05:03 nicshackle

I follow tutorial on this site https://thecodersblog.com/hardware-accleration-in-linux-with-chrome/ The package i965-va-driver not found, so I ignore it.

This can increase performance, not much but still. Tested on latest electron@3, raspberry pi 3b+, 64bit balenaOS

gersur avatar Oct 15 '19 10:10 gersur