Youtube high cpu

Hello, a topic not related to the distros, does anyone know why when you open YouTube the CPU consumes a lot and the temperature rises, does anyone know a solution?

thanks.

im using thorium browser, and this problem is with all browsers chrome or firefox related

How much % CPU is consumed and for how long, when you open youtube?

You can use the System Monitor utility for this. A short spike in CPU/temp usage followed by settling back to baseline levels is normal when opening youtube. But without playing any video there shouldn’t be a sustained hogging of the CPU. Even when you play a video unless you have no hardware acceleration, it shouldn’t take more than ~50% of your combined cores usage. This is my experience from both Linux and Windows on a fairly low end system (i5 Skylake). If you have better specs then CPU usage should be even lower.

1 Like

It could be that your browsers aren’t using hardware acceleration. You can check using nvtop – see if the GPU value fluctuates in your browser when playing a video. You can also compare it by playing a video in f.ex Clapper or mpv-based players.

Of course there’s also a possibility of YouTube’s ambient mode causing CPU spikes:

Here’s a guide just in case the problem is indeed hardware acceleration. This assumes Wayland; the following works on my device with AMD card and on another with Intel.

Firefox (Flatpak)

Navigate to about:support and check if you have something like this (Ctrl+F Codec Support).

If you don’t see it, navigate to about:config and search for media.ffmpeg.vaapi.enabled, then enable it if it’s not enabled yet. Restart Firefox and see if you notice any changes.

If you still don’t see GPU acceleration working, check if you have the following Flatpak packages installed: org.freedesktop.Platform.ffmpeg-full and org.freedesktop.Platform.openh264. If not, install them.

You’ll probably also want to make sure your browsers are allowed to use GPU acceleration in Flatseal. Honestly I’m not sure if this plays a part, but I always have GPU acceleration enabled for all Flatpaks by default.

Theoretically speaking these are the only things you need for Firefox hardware acceleration (ffmpeg-full, openh264, GPU acceleration permission and media.ffmpeg.vaapi.enabled in some computers).

Chromium, Chromium-based browsers (Flatpak)

Navigate to .var/app/org.chromium.Chromium/config/. Replace org.chromium.Chromium with Thorium or other browsers’ bundle name.

Create a new .conf file inside the config folder containing the following lines. For Chromium the file name would be chromium-flags.conf, I believe for Chrome it would be chrome-flags.conf and for Edge, edge-flags.conf. Not sure what it would be for other Chromium-based browsers.

--ozone-platform-hint=auto
--enable-features=VaapiVideoDecodeLinuxGL,VaapiVideoEncoder,Vulkan,DefaultANGLEVulkan,VulkanFromANGLE,WebRTCPipeWireCapturer, TouchpadOverscrollHistoryNavigation                                             
--enable-gpu-rasterization
--ignore-gpu-blocklist
--enable-zero-copy
--disable-gpu-memory-buffer-video-frames

That’s all it took for me to get these values in chrome://gpu and hardware acceleration to work. I also have the ffmpeg-full and openh264 Flatpak packages installed and allowed GPU acceleration.

5 Likes

Since Chromium 131, the VaapiVideoDecodeLinuxGL option was renamed to AcceleratedVideoDecodeLinuxGL, don’t know about the other options.

1 Like

Thanks for informing! I wasn’t aware of the change.