Forums

Skip to content

Advanced search
  • Quick links
    • Unanswered topics
    • Active topics
    • Search
  • FAQ
  • Login
  • Register
  • Board index Assistance Multimedia
  • Search

Excessive CPU usage playing video in browser [Solved]

Help with creation, editing, or playback of sounds, images, or video. Amarok, audacious, mplayer, grip, cdparanoia and anything else that makes a sound or plays a video.
Post Reply
Advanced search
10 posts • Page 1 of 1
Author
Message
iandoug
l33t
l33t
User avatar
Posts: 887
Joined: Fri Feb 11, 2005 5:05 pm
Location: Cape Town, South Africa

Excessive CPU usage playing video in browser [Solved]

  • Quote

Post by iandoug » Tue Nov 08, 2016 8:34 am

Hi

In recent times, playing a video eg from YouTube kicks my CPUs into overdrive (and fan noise increases to compensate).

This seems to perhaps be related to YouTube moving from Flash to HTML5 video.

Here's top:

Code: Select all

12644 ian       20   0 3595264 1.576g 111596 S 209.6 10.1   1048:54 firefox    
Firefox is streaming Bloomberg and using 209% CPU.... ?

It didn't use to be like that.

Volume control shows output controlled by CubBUtils audio stream, which I am not familiar with.

Is there a workaround / fix for this?

The Linux Mint PC behind me (lower-end model than this) does not seem to have this problem.

This PC is the first one in my .sig below.

Thanks, Ian
Last edited by iandoug on Sat Nov 12, 2016 2:36 pm, edited 1 time in total.
Asus X570-PRO, Ryzen 7 5800X, GeForce GTX 1650, 32 GB RAM | Asus Sabertooth P990, AMD FX-8150, GeForce GTX 560, 16GB Ram
Top
irenicus09
Tux's lil' helper
Tux's lil' helper
Posts: 118
Joined: Fri Jun 07, 2013 9:06 pm
Contact:
Contact irenicus09
Website

  • Quote

Post by irenicus09 » Tue Nov 08, 2016 11:43 am

Video playback on Firefox for me atleast is a nightmare, not only does it result in high cpu usage but also the webm format specifically vp9 codec used on sites like Youtube doesn't make use of hardware accleration (graphics card) so it's another reason for high cpu usage.

So basically from what I can see, you have 2 options to make use of hardware acceleration:
1) Play video inside firefox by disabling vp9 and allowing only mp4 format - which can be done by installing a plugin or manually adjusting in about:config
2) Play video through an external media player like mpv which is configured to make use of hardware acceleration by not allowing vp9 codec.

Feel free to correct me.

For me I chose to go with option #2, because from what I saw video playback even with hardware acceleration enabled has a higher cpu usage when playing a video in Firefox compared to an external player like mpv. Then again your experience might vary, I can only speak from what I have experienced.

So basically, if you choose to go for option 2, you can install a plugin called 'open_with' which basically loads the video inside mpv media player.

Or what I do is just copy current video url and press 'mod +y' in i3 Window manager to play the video.

Basically the script below can be binded to whatever key you want depending on your desktop environment.
The script basically just gets the copied link and plays the video using mpv. Not an elegant solution but it's something that works for me cos I couldn't find anything better.

Code: Select all

#!/bin/sh

url=$(xclip -o);

if [ $? -eq 0 ] 
then 
    mpv $url;
else 
    exit 1;
fi

exit 0;

Edit:


As for configuring mpv, it can you vary depending on what kind of GPU you have. You can adjust settings in ~/.config/mpv/mpv.conf

This is what I have to make use of hardware acceleration in intel GPU.

Code: Select all

hwdec=vaapi
vo=opengl
ao=pulse
fullscreen=yes
ytdl-format=bestvideo[height<=?1080][vcodec!=vp9]+bestaudio/best
cache=yes                                                                  
cache-default=50000  
Last edited by irenicus09 on Tue Nov 08, 2016 12:23 pm, edited 3 times in total.
Top
Roman_Gruber
Advocate
Advocate
Posts: 3854
Joined: Tue Oct 03, 2006 8:43 am
Location: Austro Bavaria

  • Quote

Post by Roman_Gruber » Tue Nov 08, 2016 12:12 pm

playing a video eg from YouTube kicks my CPUs into overdrive
It depends on your cpu and gpu. You may tell us what you use hardware wise and software wise more in detail. Not sure if relevant ...

Newer cpus, e.g. reference notebookcheck, provide hardware acceleration for those youtube and other video codecs. So the cpu load is much smaller in comparision.

There is also some sort of gpu acceleration when you have discrete graphics.

--

Check if your cpu and your gpu suppots those hardware acceleration.

Check useflags and how those packages are compiled

Not sure if bad kernel settings. Like setting a generic architecture or other settings may affect this?

--

I also use i3wm with no adobe flash installed, adblocker installed and no video autoplay. some advertisement videos still autoplay. Those urls are put in the host files so they resource will be relocated to localhost

My workaround is to use google chrome and opera. Some videos only load in chrome, others only in opera.
Top
iandoug
l33t
l33t
User avatar
Posts: 887
Joined: Fri Feb 11, 2005 5:05 pm
Location: Cape Town, South Africa

  • Quote

Post by iandoug » Tue Nov 08, 2016 2:01 pm

irenicus09 wrote:Video playback on Firefox for me atleast is a nightmare, not only does it result in high cpu usage but also the webm format specifically vp9 codec used on sites like Youtube doesn't make use of hardware accleration (graphics card) so it's another reason for high cpu usage.

So basically from what I can see, you have 2 options to make use of hardware acceleration:
1) Play video inside firefox by disabling vp9 and allowing only mp4 format - which can be done by installing a plugin or manually adjusting in about:config
2) Play video through an external media player like mpv which is configured to make use of hardware acceleration by not allowing vp9 codec.
Could not find any vp9 in about:config, so set everything with webm to false and restarted Firefox, but problem persists.

My video card can do acceleration. This problem did not exist in the past.... Youtube used to play without issues. VLC or Dragonplayer play without issues.

Possibly some kernel setting changed, and I missed it?

Have NVidia graphics card.
Asus X570-PRO, Ryzen 7 5800X, GeForce GTX 1650, 32 GB RAM | Asus Sabertooth P990, AMD FX-8150, GeForce GTX 560, 16GB Ram
Top
Irre
Guru
Guru
Posts: 434
Joined: Sat Nov 09, 2013 10:03 am
Location: Stockholm

  • Quote

Post by Irre » Tue Nov 08, 2016 2:34 pm

I use a completely silent 3 W Raspberry PI, powered from a telephone charger, for streaming and playback :)
Top
iandoug
l33t
l33t
User avatar
Posts: 887
Joined: Fri Feb 11, 2005 5:05 pm
Location: Cape Town, South Africa

  • Quote

Post by iandoug » Tue Nov 08, 2016 2:38 pm

FWIW, I have:

1. FIrefox: excessive CPU
2. Konqueror: excessive CPU
3. Webslice widget: excessive CPU
4. Chromium: no problem.

So it's not a kernel problem, must be some compile option or codec related ...

Thanks, Ian
Asus X570-PRO, Ryzen 7 5800X, GeForce GTX 1650, 32 GB RAM | Asus Sabertooth P990, AMD FX-8150, GeForce GTX 560, 16GB Ram
Top
Buffoon
Veteran
Veteran
User avatar
Posts: 1369
Joined: Wed Jun 17, 2015 2:22 pm
Location: EU or US

  • Quote

Post by Buffoon » Tue Nov 08, 2016 2:41 pm

https://www.youtube.com/watch?v=Ga3maNZ0x0w

I'm watching this, it is encoded with AVC1. Can your graphics card decode it in hardware?
Top
Roman_Gruber
Advocate
Advocate
Posts: 3854
Joined: Tue Oct 03, 2006 8:43 am
Location: Austro Bavaria

  • Quote

Post by Roman_Gruber » Tue Nov 08, 2016 2:47 pm

maybe not releated

google-chrome (use binary provided package from portage please)
opera

I'm not fond of firefox (i only use it for basic html pages with old passwords saved) and kde bloatware.

Google chrome is the one which i am curious if you expierence the same behaviour. Has the best user expierence for myself on different hardware and operating systems including windows
Top
iandoug
l33t
l33t
User avatar
Posts: 887
Joined: Fri Feb 11, 2005 5:05 pm
Location: Cape Town, South Africa

  • Quote

Post by iandoug » Tue Nov 08, 2016 3:02 pm

Buffoon wrote:https://www.youtube.com/watch?v=Ga3maNZ0x0w

I'm watching this, it is encoded with AVC1. Can your graphics card decode it in hardware?
Firefox: after a few minutes temperature crept up to 71 C with CPU and fans working hard.

Let PC recover back down to 45 C

Chromium: currently chugging along, temp ranging from 56 to 62 C. Seems to be stable around there.

I've also noticed that this forum software makes the CPU race when composing messages.
Asus X570-PRO, Ryzen 7 5800X, GeForce GTX 1650, 32 GB RAM | Asus Sabertooth P990, AMD FX-8150, GeForce GTX 560, 16GB Ram
Top
iandoug
l33t
l33t
User avatar
Posts: 887
Joined: Fri Feb 11, 2005 5:05 pm
Location: Cape Town, South Africa

  • Quote

Post by iandoug » Sat Nov 12, 2016 2:35 pm

Solved.

Re-emerged nvidia-drivers, and set opengl to use it rather than xorg.
Asus X570-PRO, Ryzen 7 5800X, GeForce GTX 1650, 32 GB RAM | Asus Sabertooth P990, AMD FX-8150, GeForce GTX 560, 16GB Ram
Top
Post Reply

10 posts • Page 1 of 1

Return to “Multimedia”

Jump to
  • Assistance
  • ↳   News & Announcements
  • ↳   Frequently Asked Questions
  • ↳   Installing Gentoo
  • ↳   Multimedia
  • ↳   Desktop Environments
  • ↳   Networking & Security
  • ↳   Kernel & Hardware
  • ↳   Portage & Programming
  • ↳   Gamers & Players
  • ↳   Other Things Gentoo
  • ↳   Unsupported Software
  • Discussion & Documentation
  • ↳   Documentation, Tips & Tricks
  • ↳   Gentoo Chat
  • ↳   Gentoo Forums Feedback
  • ↳   Duplicate Threads
  • International Gentoo Users
  • ↳   中文 (Chinese)
  • ↳   Dutch
  • ↳   Finnish
  • ↳   French
  • ↳   Deutsches Forum (German)
  • ↳   Diskussionsforum
  • ↳   Deutsche Dokumentation
  • ↳   Greek
  • ↳   Forum italiano (Italian)
  • ↳   Forum di discussione italiano
  • ↳   Risorse italiane (documentazione e tools)
  • ↳   Polskie forum (Polish)
  • ↳   Instalacja i sprzęt
  • ↳   Polish OTW
  • ↳   Portuguese
  • ↳   Documentação, Ferramentas e Dicas
  • ↳   Russian
  • ↳   Scandinavian
  • ↳   Spanish
  • ↳   Other Languages
  • Architectures & Platforms
  • ↳   Gentoo on ARM
  • ↳   Gentoo on PPC
  • ↳   Gentoo on Sparc
  • ↳   Gentoo on Alternative Architectures
  • ↳   Gentoo on AMD64
  • ↳   Gentoo for Mac OS X (Portage for Mac OS X)
  • Board index
  • All times are UTC
  • Delete cookies

© 2001–2026 Gentoo Foundation, Inc.

Powered by phpBB® Forum Software © phpBB Limited

Privacy Policy

 

 

magic