Is this level of CPU usage while playing video normal? Topic is solved

Talk about code development, features, specific bugs, enhancements, patches, and similar things.
Forum rules
Please keep everything here strictly on-topic.
This board is meant for Pale Moon source code development related subjects only like code snippets, patches, specific bugs, git, the repositories, etc.

This is not for tech support! Please do not post tech support questions in the "Development" board!
Please make sure not to use this board for support questions. Please post issues with specific websites, extensions, etc. in the relevant boards for those topics.

Please keep things on-topic as this forum will be used for reference for Pale Moon development. Expect topics that aren't relevant as such to be moved or deleted.
retronostalgia

Is this level of CPU usage while playing video normal?

Unread post by retronostalgia » 2017-06-07, 16:07

Greetings, this is my first post - thanks very much for all of your work in providing this excellent browser.
I've done some forum and web searches but since I haven't turned up anything I thought I'd ask.

When I download a youtube video (with say, with Complete Youtube Saver) and play it in SMPlayer, my CPU usage runs at about 8% according to system monitor. Playing them in the browser, however, seems to take at least 60% and sometimes over 100%.

My questions:
* Is this normal?
* Is there any way to reduce CPU usage using the HTML5 player, or is installing the Flash player my only option?
* Would installing a different flavor of FFMPEG potentially help?

Thank you! If you need any more details feel free to ask.

Some details on my setup:
Laptop, CPU is i7-7600U, 16GB ram, 512GB SSD, screen resolution 1920x1080.
Running Arch Linux installed using the Antergos installer.
Using the MATE desktop
Default FFMPEG package installed.
Compton compositor installed.
SMPlayer configured to use mpv engine and vaapi backend.

Pale Moon 27.3.0 (64 bit) installed using the palemoon-bin AUR package.
In about:config, all "media." variables are set to their defaults. (specifically, media.ffmpeg.enabled is "true")
In preferences, MSE are enabled and the box for MP4 support is ticked, but not the one for WebM. in "Advanced", "use hardware acceleration when available" is checked.
installed extensions: Bamboo Feed Reader, Complete YouTube Saver, CookieKeeper, F.B. Purity, Google search link fix, NewsFox, uMatrix

Graphics details from about:support
Adapter Description Intel Open Source Technology Center -- Mesa DRI Intel(R) HD Graphics 620 (Kaby Lake GT2)
Device ID Mesa DRI Intel(R) HD Graphics 620 (Kaby Lake GT2)
Driver Version 3.0 Mesa 17.1.1
GPU Accelerated Windows 0/1 Basic
Vendor ID Intel Open Source Technology Center
WebGL Renderer Intel Open Source Technology Center -- Mesa DRI Intel(R) HD Graphics 620 (Kaby Lake GT2)
windowLayerManagerRemote false
AzureCanvasBackend cairo
AzureContentBackend cairo
AzureFallbackCanvasBackend none
AzureSkiaAccelerated 0

User avatar
trava90
Contributing developer
Contributing developer
Posts: 1736
Joined: 2013-05-20, 18:19
Location: Somewhere in Sector 001

Re: Is this level of CPU usage while playing video normal?

Unread post by trava90 » 2017-06-07, 22:42

The next release of Pale Moon will include several fixes for media playback performance. If you want to test these, you can try the unstable builds (though please do read the warnings first).
retronostalgia wrote:In preferences, MSE are enabled and the box for MP4 support is ticked, but not the one for WebM.
MSE + WebM has some known issues which is why it is disabled by default.

User avatar
Moonchild
Pale Moon guru
Pale Moon guru
Posts: 35481
Joined: 2011-08-28, 17:27
Location: Motala, SE
Contact:

Re: Is this level of CPU usage while playing video normal?

Unread post by Moonchild » 2017-06-07, 23:58

As a side note, your setup (using the integrated intel HD GPU) isn't hardware accelerated (see the troubleshooting info). As a result, Pale Moon can't off-load the video decoding task to the GPU and will decode and render everything in software (CPU) which causes your high load.
Dedicated media players have a much easier task focusing on HW acceleration, since they are going to be single-platform, dedicated applications that don't have to render the video as a part of other content, like web browsers. That's why HW acceleration can fall by the wayside in Pale Moon for a lot of embedded graphics.
"Sometimes, the best way to get what you want is to be a good person." -- Louis Rossmann
"Seek wisdom, not knowledge. Knowledge is of the past; wisdom is of the future." -- Native American proverb
"Linux makes everything difficult." -- Lyceus Anubite

retronostalgia

Re: Is this level of CPU usage while playing video normal?

Unread post by retronostalgia » 2017-06-08, 03:06

Thank you gentlemen for the tips.

I assume that the "GPU Accelerated Windows 0/1 Basic" line in about:support is what was telling me that I didn't have any hardware acceleration?

Is it the case that Pale Moon hardware accelerated video playback isn't supported for Intel graphics on Linux *at all*? Or is it something like VDPAU is supported but VA-API is not?

If it's the latter, I can try tinkering a bit and will report back if I find a combination that works.

Cheers!

retronostalgia

Re: Is this level of CPU usage while playing video normal?

Unread post by retronostalgia » 2017-06-08, 03:24

Doing some searches, it sounds like neither VDPAU nor VA-API is supported on Linux in Firefox, so I assume the same is true for Pale Moon. Also sounds like it'll be a while before this changes:

https://bugzilla.mozilla.org/show_bug.cgi?id=563206
https://bugzilla.mozilla.org/show_bug.cgi?id=1210727
https://bugzilla.mozilla.org/show_bug.cgi?id=1210729

I will do some checking when I have time, for reference, and see how things change if I use the Flash player instead.

Thanks...

retronostalgia

Re: Is this level of CPU usage while playing video normal?

Unread post by retronostalgia » 2017-06-08, 17:01

Getting the Flash player working properly was a headache, but I think I've figured it out. In case anyone else is curious...

I first tried installing Arch's flashplugin package, which is the NPAPI version. I also installed HTML5 Media Tuner from https://addons.palemoon.org/addon/html5-video-tuner/. I enabled HW decode in /etc/adobe/mms.cfg according to the Arch guide at https://wiki.archlinux.org/index.php/Browser_plugins#Flash_Player, but while flash was installed and working according to Adobe's test page at https://helpx.adobe.com/flash-player.html, YouTube would hang on the first frame of video and eventually just go black - payback didn't work at all. I don't think this is a Pale Moon-specific issue as I ran into similar problems trying it with Firefox.

Digging further, I uninstalled the flashplugin package and installed the pepper-flash and freshplayerplugin packages. (the PPAPI version.) This worked, and played Youtube videos fine, but CPU usage was only marginally better than with HTML5. In order to get hardware accelerated video working, I referred to the Arch Wiki page again and copied /usr/share/freshplayerplugin/freshwrapper.conf.example to ~/.config/freshwrapper.conf. Then in the file I set enable_hwdec = 1 (and enable_vsync = 0 since the Compton compositor I use takes care of vsync already.)

That did it! CPU usage playing YouTube video is now down to ~25% total between palemoon and plugin-container, vs. >60% using HTML5.

retronostalgia

Re: Is this level of CPU usage while playing video normal?

Unread post by retronostalgia » 2017-06-08, 21:32

An interesting addendum...

I have an older laptop with an i5-2540M CPU and 1366x768 screen resolution. It seems to use 10-20% less CPU playing youtube videos than my new laptop, if both are compared with the default HTML5 player. In other words, with the default config, my new laptop uses ~60% CPU to play youtube videos while my old one only needs ~%40. In both cases, Youtube videos are not fullscreen. Both laptops are running Arch and have palemoon-bin (27.3.0) installed.

It's academic, since I've switched to using the Flash player, but I wonder why that might be...

machinedgod

Re: Is this level of CPU usage while playing video normal?

Unread post by machinedgod » 2017-06-22, 18:52

Hi,
I registered purely to report same issue, being directed to do so on Freenode/#palemoon. When running any video service, palemoon spikes to about 70-80% CPU, but then underlying Xorg server spikes up even further and grinds to a halt at 99%.
I am on Arch Linux, running xmonad with compton, on an I7 laptop.

I tried:
- http pipelinening options
- running generic palemoon binary downloaded from the website (instead of Arch Linux AUR version)
- running on the secondary nvidia GPU using primusrun bridge

These steps didn't work, but user addy from the IRC directed me to this webpage: https://forum.palemoon.org/viewtopic.php?t=13872#p111593


It solved it for me!

retronostalgia

Re: Is this level of CPU usage while playing video normal?

Unread post by retronostalgia » 2017-07-01, 16:40

Hi machinedgod, thanks for the info. I thought I had my settings such that I'd get an alert when someone replied to this thread, but apparently I have something mis-configured.

I had an issue where flash stopped working for me, (turns out un-installing and re-installing fixed it) so I loaded up this thread again for reference and saw your reply.

I didn't realized that while installing flash let me play YouTube videos with much lower CPU usage, I had never actually verified that I had GPU accelerated windows working. And, checking about:support again, it turns out I didn't. Using the thread you linked and a couple of other resources, I did the following:

Set webgl.force-enabled to true.
Set layers.acceleration.force-enabled to true.
Set layers.offmainthreadcomposition.enabled to true.
Added export MOZ_USE_OMTC=1 to ~/.profile (since i didn't have a ~/.profile file I just created a new one with that line only.)

Re-starting Pale Moon I can now see in about:support in the Graphics section the line GPU Accelerated Windows 1/1 OpenGL (OMTC), so it looks to have worked. In my case however I don't see a big difference in behavior; I wasn't having the problem you saw of high Xorg CPU usage, and enabling GPU accelerated windows doesn't look to have changed CPU usage while playing YouTube videos for me. Still, good to know!

retronostalgia

Re: Is this level of CPU usage while playing video normal?

Unread post by retronostalgia » 2017-07-02, 00:41

...and now I've gone and turned hardware acceleration back off, as it leads to annoying intermittent flickering of page elements. I guess there's a reason it's off by default...

User avatar
Moonchild
Pale Moon guru
Pale Moon guru
Posts: 35481
Joined: 2011-08-28, 17:27
Location: Motala, SE
Contact:

Re: Is this level of CPU usage while playing video normal?

Unread post by Moonchild » 2017-07-05, 12:32

retronostalgia wrote:...and now I've gone and turned hardware acceleration back off, as it leads to annoying intermittent flickering of page elements. I guess there's a reason it's off by default...
Pale Moon's HW detection and use is making decisions for usually very practical reasons; so yes, it's off by default for a reason, and forcing it on will likely have negative effects.
"Sometimes, the best way to get what you want is to be a good person." -- Louis Rossmann
"Seek wisdom, not knowledge. Knowledge is of the past; wisdom is of the future." -- Native American proverb
"Linux makes everything difficult." -- Lyceus Anubite

retronostalgia

Re: Is this level of CPU usage while playing video normal?

Unread post by retronostalgia » 2017-08-23, 16:25

Updating the situation, YouTube video playback using the flash player stopped working for me several weeks ago, and I'm not sure why. (the issue persists even though, for other reasons, I did a complete OS reinstall.) I'll report back if I manage to find a way to re-enable it.

User avatar
adesh
Board Warrior
Board Warrior
Posts: 1277
Joined: 2017-06-06, 07:38

Re: Is this level of CPU usage while playing video normal?

Unread post by adesh » 2017-08-23, 16:40

Because YouTube now supports only HTML5 player as Flash is dying.

retronostalgia

Re: Is this level of CPU usage while playing video normal?

Unread post by retronostalgia » 2017-08-23, 20:09

Looking at the comments on this page: https://www.mrfdev.com/youtube-flash-player it appears that while YouTube has made some changes it's still possible to play YouTube videos with flash. I've tested that plugin with firefox just now and it works properly, but I don't know of a way to make it work with Pale Moon.

retronostalgia

Re: Is this level of CPU usage while playing video normal?

Unread post by retronostalgia » 2017-08-23, 21:13

For reference, this thread has more info: https://forum.palemoon.org/viewtopic.php?f=3&t=16254

I haven't been able to get the y2p extension (https://addons.mozilla.org/en-Us/firefox/addon/yt2p/) to work properly on linux yet; if I give it the full path to the player it will launch the player, but doesn't seem to give it the URL.

Locked