Stremio / stremio-features

Post Feature requests in Issues here
90 stars 11 forks source link

Stremio needs hardware decode (vaapi) on linux #23

Closed htot closed 4 years ago

htot commented 8 years ago

When using stremio on underpowered HW like an Atom E3815 as in an Intel NUC DE3815TYKHE as I use as a set-top box it is essential to use HW decode and scaling, i.e. on linux through VAAPI. The reason is that the CPU is absolutely not up to decoding 1080p.

(why choose such a NUC as set-top box? It takes about 5W so you can leave it always on)

To get everything running smoothly, VLC is not a solution as VLC decodes in HW but then transfers back to the CPU for filtering and the result is even worse then CPU decoding. Also HTML5 decoding (in chromium and firefox) is bottlenecked (not sure if that is using HW decode or not).

If video must be streamed through a player I found MPV worked very well (with popcorntime which had the same problem). But obviously it would best to use ffmpeg or gstreamer directly.

Ivshti commented 8 years ago

With the limitation of doing everything with Electron / Chromium, using libav or gstreamer wouldn't really help much. Libraries like WebChimera.js (the one we use) have an inherent limitation in Electron - chromium's multi-process architecture

However, using mpv as an external player should work I think

if it can emit/receive events to/from the app, it would be integratable

htot commented 8 years ago

I don't know what events would exactly be needed, but here is more info: https://mpv.io/manual/master/

htot commented 8 years ago

I see there is also a version of WebChimera that uses gstreamer. Gstreamer supports vaapi. That might work?

Ivshti commented 8 years ago

Theoretically yes - but wc.js with gstreamer is very very far from being complete. Also, in near future, we're going to stop using it. Also, does VLC support vaapi? we're going to look at implementing mpv.io player integration

htot commented 8 years ago

VLC supports vaapi but as far as I can tell after the decode phase but before scaling everything goes back to the CPU to allow certain filters. The result is it will be very slow (unusable) on baytrail. I read somewhere they are planning to be able to bypass this so performance might improve but currently I only had good results using mpv.

Ivshti commented 8 years ago

There's an another issue as well - webchimera.js draws frames in an UInt8Array and then sends them to the GPU with webgl's Teximage2d.

This has two issues

  1. Electron, which we use, is based on chromium and that means separate GPU process to which we have to copy the textures. That's one additional copy in the flow 2 we can't leverage vaapi to decode frames directly to the GPU

So - as I said - we are working on our architecture to generally improve on those issues :)

htot commented 8 years ago

Just tried VLC with the latest Stremio on a Intel NUC with Baytrail. With VLC with HW decode and accelerated output SD movies play fine and 720p are watchable. 1080p not.

Looking forward to be able to use MPV.

htot commented 7 years ago

Any news here?