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!

Quasdunk
  • 441

2 Answers2

6

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.

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.

Felipe
  • 1,049