Jump to content

Choppy/laggy video playback in Linux VMs

Recommended Posts

Hi all,


I'm hoping someone can help with this because I haven't been able to find a fix and it's driving me crazy.


I always have choppy video playback in my Linux VMs.  


Here is my setup:

- My Unraid machine has 128GB of RAM.  2 Xeon processors, 8 cores each with hyperthreading for a total of 32 virtual CPUs

- I isolated CPUs and let Unraid and most of my dockers have the first 4 CPUs and its paired HT for a total of 8 virtual CPUs (all from processor 1).

- the other 8 virtual CPUs (on the same processor 1) went to Emby.

- Unraid and all my dockers work great


- processor 2 has a Win 10 VM using 8 virtual CPUs and 16 GB of RAM and a Nvidia GPU passed through

- processor 2 also has a couple Linux VMs running on 4 virtual CPUs each and each using 8 GB of RAM. They also use Nvidia GPU passthrough


- All VMs are connected to my 4K TV with HDMI

- Win 10 set to 3840x2160

- Linux VMs also set to 3840x2160

- All VMs work smoothly and give a very clear picture when using any programs I want (except video playback in Linux)


Which brings me to my issue:

- All Linux VMs have an issue with video playback.  doesn't matter if I play a local file or watch youtube. It doesn't matter what the video quality is set to...SD 480 all the way up to 4K.  It is always choppy/laggy, never smooth.

-My Win 10 VM can playback videos of ANY quality and it is smooth and clear.  It doesn't matter if it's streamed or played from a local file, it's all good.

- I have tried multiple different Linux distros. diff desktop environments. Xorg and Wayland protocols.  I have used the same GPU I am using on my Win 10 VM, with the same HDMI cable and same HDMI port on the TV,  I have tried the latest Nvidia drivers and the Linux Nouveau drivers... I get the same issue every time. 

- I also played around with different amounts of RAM and different virtual CPU cores(always paired) I assign to the Linux VMs.  I also tried moving the VMs on to my 1st processor and tested with nothing else running except 1 Linux VM at a time... NO change. 


- If I drop my Linux OS resolution down to 1920x1080 it is no longer choppy, I get smooth playback.  but I sacrifice the much clearer 4K resolution.   

   ***Edit:  It's still choppy at 1080, but it's less noticeable than at 4k. 


I am new to Linux but my goal is to learn it and convert completely to Linux from Windows.

I'm sure there must be a fix for this but I can't find it.


If anyone has any ideas on how I could fix this I would really appreciate it. 


Thanks in advance!


Edited by Tonitram
Link to comment

An older GTX 660 ti.  Im not using the VMs for any gaming.  Just need it for video playback which Nvidia says it can handle (and it does handle it fine in my windows VM).  But I did also test it with a GTX 1070 just in case, but it had the exact same issue.

Edited by Tonitram
Link to comment
  • 11 months later...

I have exactly the same issue. It doesnt matter which linux distro I am using. I tried Ubuntu, Kubuntu, Xubuntu, Manjaro (did not install). I am trying with a Nvidia K4200 and a Nvidia GTX 1080 with both I get stuttering of sound and video on 4K or lower resolution monitors (LG and NEC). So I dont know any further.


Can someone please help us!


Thanks a lot

Link to comment

So this is probably less of an Unraid, KVM/Qemu issue, and more of a Linux itself issue.

From that perspective:

- What distribution are you using?
- What driver is being used (nvidia? nouveau?)

Some useful information from within the Linux VMs would be relevant GPU information from the distro:

dmesg | grep -e nouveau -e nvidia
the contents of /var/log/Xorg.0.log
lspci | grep vga

We need to see what the topology of the display server from the ground up looks like. I have extensive experience with Linux on bare metal for desktop use.
This should be effectively no different assuming the KVM-VFIO passthrough is being handled properly (Which, judging from the Windows performance, it is.)

If nouveau is mucking about, then it would explain part of your choppy video playback experience - nouveau has very basic 2d and 3d support on most newer cards, and has no support for the nvenc/nvdec pipelines. The nvidia proprietary driver has nearly complete feature parity with the Windows drivers, however nvidia has made questionable decisions on the default driver settings for a modern desktop environment on Linux. For example, they choose to not enable the full composition pipeline, which leads to sync issues between layers on the desktop - which results in full-screen tearing, even with vsync enabled. These settings can be manipulated obviously - but first we need to figure out the "what" of your problem.

Link to comment

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

  • Create New...