Why Youtube 4K playback sucks on Linux?

If I can I play 4K videos on Youtube even though I have a 1080p display - simply the 4K stream allows more bandwidth so the image is better. On my PC with Windows 10 there are no issues doing this. With Linux - be it Manjaro or anything else - there is! I conducted a little test, lot’s of pictures below.

Test video: Gamers Nexus random video played at 4K

Specs:

Firefox versions on Linux and Windows
linux_ff

Win10 frame drops (it stays 0 throughout the video):
win10

Linux frame drops after 5 minutes (4% frame drops!):
linux2

Windows CPU and GPU utilizations: CPU around 40%, GPU around 29%


Linux CPU and GPU utilizations: CPU around 60%, GPU around 11%


And this is by far the best result on Linux. And it’s still shite. What’s the problem? All I can see is that CPU utilization is higher, and GPU is lower. But it still uses GPU.

Hello @tonyrulez :slight_smile:

The problem on Linux is that Firefox does not support Video Decoding over VDPAU (Nvidia), but supports VAAPI (Open Source) and at the moment only some Intel Chipsets.

OpenGL Rendering on the GPU is not the same as Video Decoding. Yes it improves Rendering, but not Video Acceleration.

If you need 4k, then it is a good idea to use a normal video player, which supports video acceleration.

Play the video with mpv for example.

pamac install mpv youtube-dl
pamac build ff2mpv-native-messaging-host-git

And install this Add-On: ff2mpv – Holen Sie sich diese Erweiterung für 🦊 Firefox (de)

Now you should be able to open a youtube link and click on the extension shortcut. It will open mpv with this youtube video with the highest possible resolution.

Here is how I did it on the terminal:

mpv --vo=gpu --hwdec=nvdec --hwdec-codecs=all --ytdl-format="bestvideo+bestaudio" "https://www.youtube.com/watch?v=r7hNmuizMB8"

You might want to add it to your mpv.conf:
~/.config/mpv/mpv.conf

 vo=gpu
 hwdec=nvdec
 hwdec-codecs=all
 ytdl-format="bestvideo+bestaudio"
3 Likes

That’s quite unfortunate but I will try out your method, thanksfor the help :slightly_smiling_face:

@tonyrulez

Ah, i forgot to mention. Chromium based Browsers can use Video Decoding Acceleration, but it is blocked by default, because it is not really stable, but you can try it:

(I use FF mainly, so did nit think of it.)