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