Comments (23)
I think this is related to this post: nwjs/nw.js#3293 (comment)
from webchimera.
Thanks, this seems interesting.
Still, passing frames and drawing them in canvas will obviously be terrible in performance.
Drawing in an OpenGL context would be best, and I don't know how the bindings would happen.
from webchimera.
The problem is there are no way combine accelerated output with windowless mode (and have some custom controls over video) on Windows platform. It's exactly the reason why WebChimera was created.
On Mac OS X all is totally different - all UI there is hardware accelerated by design, so windowless NPAPI get advantages from this too.
The app is NW.js-based. I am thinking that if there was a limitation before, currently with the latest Chromium codebase there would certainly be a way to wire in an NPAPI plugin directly into the browser composing, avoiding the need to have it's own window and still having hardware acceleration.
To have accelerated output, we have to use some sort of hardware accelerated drawing engine, but NPAPI on windows could work only with HWND, so we have two choices:
- use GDI (which was created in 199x and know nothing about hardware acceleration) - and have poor performance;
- create DirectX/OpenGL view over passed from browser HWND - and have problem with items overlapping;
One possible solution could be pass WebGL context from browser to NPAPI plugin - then browser will know how embed it into html renderer seamlessly - but don't think it will be created ever since NPAPI declared as deprecated.
from webchimera.
So, from what I understand, Windows has this problem by design.
And how is WebChimera's performance compared to VLC? Is there any overhead there, maybe frame copying related to the Qt integration?
from webchimera.
Obviously it has some overhead, but on desktop platforms it's not significant. Of course some additional optimizations are possible, but since nobody complain on WebChimera performance - I prefer spend time on more important things...
from webchimera.
btw, on Mac platform WebChimera has even more overhead than on Windows - since it renders to texture at least two times: first time for video, second when renders final scene to CALayer (which is some sort of texture on Mac OS X).
from webchimera.
I would have to disagree here. I don't know how much the overhead is, I am yet to research that, but if it's significant enough, it could be a big hit on energy consumption over watching a whole movie - e.g. consuming 10% on native playback and 50% on a non-optimized video player.
Again, I don't know how significant Webchimera's overhead is.
from webchimera.
Using JS to write application is the first place overhead :)
from webchimera.
so if you mind about energy consumption - it will be better use native application written on C++ or something similar.
from webchimera.
You're generally right. The design was to use native for every critical component, such as the video - and since HTML5 provides a video tag, this design works fine. Until more codecs and features are required, and it becomes obvious re-compiling with more ffmpeg flags won't do the entire job.
WebChimera is probably the best solution here. Or using libvlc for a new NPAPI plugin, then re-writing the controls natively for every OS, but this would be time consuming.
from webchimera.
Anyway WebChimera adds just a few percents of additional cpu load compared to vlc player. On my system something like 3-5% instead of 2-3% - but this only on some specific movie - I didn't do any special measurements.
If you will do something like this, I will be glad to see your results. And even I think it could be useful to other WebChimera users.
from webchimera.
WebChimera is probably the best solution here.
Maybe, at least I don't know any alternative.
Or using libvlc for a new NPAPI plugin, then re-writing the controls natively for every OS, but this would be time consuming.
Even if you will use native controls over libvlc output window - you could have some glitches. I've already met this issue when did toolbar for Vlc Web Plugins on Windows.
from webchimera.
Something like 3-5% vs 2-3% seems insignificant and would maybe result in 20-30% battery usage increase, which at the point would not be worth to dig into.
Out of curiosity though - why Qt? Would it be possible to simply overlay a transparent WebKit instance over VLC? Would it be more performant?
from webchimera.
Out of curiosity though - why Qt?
Just because it has QML which allow define additional controls and effects in plain text file, which could be loaded over network for every specific application. I.e. something like html but more simple and hardware accelerated by design.
Would it be possible to simply overlay a transparent WebKit instance over VLC?
I think it's possible, but didn't try. But this approach has one disadvantage: you could not apply any effects to video. For example you could apply huge amount different effects directly to video (transitions, transparency, rotation, moving, scaling, blur and many many others. look http://doc.qt.io/qt-5/graphicaleffects.html ) with WebChimera, not only place additional controls.
Would it be more performant?
It could be, but it's just not so interesting as WebChimera :) And I don't sure how complicated is task to place html engine over OpenGL/DirectX view (libvlc use them for video output too).
from webchimera.
I see. One more question - where does the overhead in WebChimera come from exactly. A few percent sound too little to be from copying buffers.
I'll soon test playing a 1080p tv show on OS X / Windows with VLC, HTML5 video and WebChimera and post the results (CPU usage)
Btw it's amusing, one or two years ago when we were still in the prototype phase of our app, we found that windowless vlc is extremely heavy, I wrote a Qt + VLC plugin (not firebreath, but qt-npapi or something like that) and used it with QML. Dropped it because HTML5 video seemed sufficient at the time and it was too tiresome to compile every time.
from webchimera.
I see. One more question - where does the overhead in WebChimera come from exactly. A few percent sound too little to be from copying buffers.
Yes, exactly. Libvlc decodes video frames to buffer in main memory, after that I upload them to texture (with texImage2d). One possible optimization is decode directly to GPU memory with something like PBO. You could read following discussion about used in WebChimera approach: https://forum.videolan.org/viewtopic.php?f=32&t=121786
And plus QML engine itself consume some amount of CPU and GPU time.
Btw it's amusing, one or two years ago when we were still in the prototype phase of our app, we found that windowless vlc is extremely heavy, I wrote a Qt + VLC plugin (not firebreath, but qt-npapi or something like that) and used it with QML. Dropped it because HTML5 video seemed sufficient at the time and it was too tiresome to compile every time.
Good ideas have to come to more than one head :) I've started work on WebChimera in december 2013
from webchimera.
Now this is mega-curious. I expected bigger differences if buffer copying is involved.
OS X
VLC - 33-38%
HTML5 - 40-45%
WebChimera - 40-46%
Windows
VLC - 5-7%
HTML5 - 8-9% (but split between two NW.exe processes, one using 2-3%)
WebChimera - 8-9%
from webchimera.
Funny, so WebChimera even better than we thought :)
Btw what hardware do you have with OS X ?
from webchimera.
iMac, late 2013, i5, 8GB RAM. I don't know why the % is so high compared to the Windows, which is i7 Dell Vostro laptop from 2013. Maybe just because of software differences. It didn't feel "heavy" and I didn't feel a system slowdown when playing the video - and it played perfectly. The difference was purely in the numbers.
from webchimera.
hm... looks really strange. Unfortunately can't remember what load I had on Mac.
from webchimera.
It could be related to I/O. I have a fusion drive and apparently Apple implemented it badly, because all of my I/O is really slow.
Also, could be that the OS X activity monitor shows % of the usage of one core/thread, and the Windows one showing the % of usage of the entire processor. In this case we divide all the OS X % by 4 or 8 (depending on core or thread).
Dividing by four - OS X
VLC 8.25-9.5%
HTML5 10-11%
WEbChimera - 10-11%
That makes more sense. Considering the performance difference between i5 and i7 everything fits in.
from webchimera.
@Ivshti, can we close this issue?
from webchimera.
Sure. It's no longer relevant.
from webchimera.
Related Issues (20)
- Option to move or show player on another screen HOT 39
- How to change default asceptratio to 16:9 : HOT 4
- Setup nightly builds on http://launchpad.net
- Linux: plugin don't get keyboard events
- playlist item's .setting HOT 1
- Feature Request - nw.js 64-bit support HOT 4
- Crash In Browser HOT 9
- Image frozzen on Firefox with high resolution HOT 8
- MediaPlayerStateChanged should fire only on real state change HOT 11
- Taking snapshots with WebChimera Plugin HOT 112
- Passing custom VLC arguments? HOT 4
- 'application/x-fb-vlc' mode doesn't support autoloop HOT 1
- Plugin crashes at the end of .m3u8 files HOT 3
- Packaging with VLC 3.0 does not work HOT 8
- Filter Invert Colors HOT 11
- Filter - Hue Support HOT 8
- Error: The specified module could not be found. HOT 2
- How do you play local video files HOT 2
- Video not showing when using vlc 2.1.5
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from webchimera.