15

I've been googling around for a few weeks now and trying all the different solutions, but I could neither find a working solution nor a satisfying answer to my question: Why does a Youtube HTML5 video on Ubuntu / Linux make the CPU go through the roof? Since I've found similar questions, I know it's not only me.

I have an Nvidia GeForce 660M and Intel Graphics on a Core i7 (with 8 cores).

Watching a 1080p video on Ubuntu 16.04 (with both Firefox and Chromium) the CPU load builds up to 100% over a few minutes, turning the video into a slide show and making the computer not usable at all. But streaming those videos with VLC or Totem is no problem whatsoever (that's why most solutions I've found so far suggest this workaround).

Watching the same videos on Windows (on the same laptop) does not really look differently from editing a Word file in terms of CPU load.

So this means the problem must be specifically related to the browser in combination with Linux / Ubuntu.

Yes, HTML5 is supported:

html5-support


Yes, I have Nvidia drivers installed:

enter image description here


Here's what chrome://gpu gives me:

enter image description here


So it seems like hardware acceleration for video decoding is not available. How can I make it available? Is it even possible? If no: Why not and will it ever be? Is there another configuration option that I'm missing?

It's 2017 and being able to watch funny cat videos in high quality on a decent computer should be a pretty basic thing!

6
  • hardware acceleration hasn't been enabled since 2012 and it won't be anytime soon from what I read. Nonetheless, you shouldn't have a problem using software decoding for your videos, your CPU shouldn't jump that high. Do you experience the same when using Firefox? if so, it might be related to the fact that you have 2 graphics cards – Felipe Jun 7 '17 at 18:08
  • @Felipe That doesn't really sound very promising. Yes, I also stumbled upon an articel from 2014 stating something similar, but since it's really old I didn't take it too seriously. And yes, I also read about the 2 graphics card issue, that's why I installed nvidia-prime and explicitly told it to use the Nvidia GPU as suggested here. I really can't believe hardware acceleration is not possible on one of the most popular OS... And yes, it's the same in Firefox (and Vivaldi). – Quasdunk Jun 7 '17 at 18:22
  • so does the same happens when using Firefox? like I said, if it does it might be harder to solve, but if Firefox works fine, then it might just be a faulty Chrome installation. Also, try making nvidia-prime only use the Intel GPU. I would test every possibility to see what happens and narrow down the problem. – Felipe Jun 7 '17 at 18:29
  • @Felipe sorry, I've edited my comment later on regarding other browsers. So yes, it's the same in Firefox, Chromium and Vivaldi. I did now switch to the Intel GPU, even though I had tried that too, but that was a while ago and some things changed since then. It seems to run more stable (the load average did not go above 2.0 even after 5 minutes). If that's really the solution, the issue might be with the Nvidia drivers (even though I've tried all of them already). I'll have a look at how the Intel GPU handles it now in a longer term and report back :) Thank you! – Quasdunk Jun 7 '17 at 18:47
  • Have you tried using the Nvidia drivers from this ppa, give it a try they have the latest stable drivers: launchpad.net/~graphics-drivers/+archive/ubuntu/ppa – Felipe Jun 7 '17 at 19:02
2

Since your system has both Nvidia and Intel GPU, and the problem is found on every single browser you're using. It's definitely a problem with the drivers and not the browsers. Even though Chrome is not helping by not providing video hardware decoding. You should try using only the Intel GPU which has more stable drivers on Linux.

@Quasdunk reported that switching to the Intel GPU lowered significantly the load on the machine and now it's usable.

If you really want to use the Nvidia GPU, you should try upgrading your drivers using this ppa.

3
  • 1
    Thank you very much! Even though it turned out to be more of a driver issue rather thank specifically browser/OS related, just one more time for the record: Hardware video acceleration does not work on Linux and won't be working any time soon! Switching to the Intel GPU makes it now bearable, but using 30% of an i7 CPU just to watch a video in the browser is still pretty insane. – Quasdunk Jun 8 '17 at 14:00
  • I have a T460p with an Nvidia GeForce 940MX on Ubuntu 18.04. I turned the setting to "battery saving" (using the CPU instead of the GPU). This made my computer SUPER hot some times when watching YouTube. Interestingly, only recently (a couple of days ago, I guess). I'm not sure if I changed anything. I have chrome 79.0.3945.79 at the moment and changing the Nvidia setting to performance (using gpu) seems to have fixed the issue. – Martin Thoma Dec 22 '19 at 17:23
  • Never mind, it did NOT solve my problem. I had wg-gesucht.de/wg-zimmer-in-Muenchen-Berg-am-Laim.3570695.html open for a while and it started using heating my CPU up again. – Martin Thoma Dec 22 '19 at 17:45
4

I had similar issue. My CPU used >100% in htop while watching YouTube videos in 1080p.

Specs:

CPU: 7700k
GPU: Nvidia GTX 1080
Drivers: 384.69

I had to install these plugins:

sudo apt install gstreamer1.0-plugins-bad gstreamer1.0-plugins-ugly

Then went to Google Chrome flags page chrome://flags/ and enabled option:

WebRTC H.264 software video encoder/decoder Mac, Windows, Linux, Chrome OS

Screen: enter image description here

After restarting browser my cpu usage dropped to around 30%.

As a last resort You can always disable Video Hardware Decode by using command line:

google-chrome --disable-accelerated-video-decode 

Here's a list of all possible command line options for Google Chrome: https://peter.sh/experiments/chromium-command-line-switches/

Alternative Solution:

There is another thing that, for me, made my CPU go high. It was a js script on the YouTube. I had to block it in uBlock addon:

enter image description here

Red rectangle shows many requests from a mss_4.js script - this caused the CPU spikes. Green rectangle shows that the script is blocked inside the uBlock addon, so no more request inside the mss_4.js are made.

1
  • A shortcut for WebRTC flag chrome://flags/#enable-webrtc-h264-with-openh264-ffmpeg – Md. Abu Taher Jan 28 '19 at 7:02

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.