Enhanced Video Player on Apple TV 4K creating buffering issues

So today I setup a Win10 Pro Hyper-V VM on my Server 2019, and installed Plex. Networking was setup so that basically the 2nd NIC on my system was used directly to the Win10 Pro VM. Testing went flawless - so here I am tonight doing the following:

  1. Backing up the registry key and Plex Media Server to my ReFS Volumes, where my media sits
  2. Downloading Drivers and Software (Nvidia Drivers, Motherboard Drivers, etc.)
  3. Loading Win10 Enterprise (which supports ReFS) overtop my C:\ volume - which is a motherboard/Intel Rapid Storage raid 5 array of four 224GB SSDs
  4. Re-installing Plex, bringing my HyperV VMs back over, and then using my AppleTV via Enhanced Video Player
  5. ???
  6. Profit!!!

Wish me luck!

Same hardware - but Win10 vs Server 2019. Works flawlessly on Win10 Enterprise v10.0.19041.

It’s terrible that it’s so much of a hassle but it’s not the end of the world.

Having the same issue, only occurs with the enhanced player. Server is Win10 based, tried on two different Win 10 Pro machines, same delay on my 4 Apple TV’s and my iPad. Please fix this… it makes plex very unfun to use.

I don’t think you are having the same issue. I went through a lot of logs before and after switching from Server 2019 to Win10 Enterprise (Pro worked too, but needed ReFS support).

What’s your playback settings on the AppleTV, and what’s your server connection look like? and bitrate of the file?

We have 4 Apple TV 4ks in the house, 2 iPhones, and 2 iPads. All of them have a 10 to 20s delay when playing any videos only with the enhanced player. Playing with a browser on a PC or old player works perfectly, playback is instant and we can skip around the file with zero lag. With the enhanced player on x265 videos take about 20s to play, x264 take 5 to 10 seconds. Every time you skip in the episode, same lag. It’s making plex kind of unfun.

I just replaced my Win 10 Pro Intel NUC PMs server install with a much more powerful Win 10 desktop server installation. Identical lag issues, even with radically more powerful hardware behind the server now. Almost all my devices but the mobiles are on our 1000 Mbps Ethernet lan. There’s literally no reason for the delay on every video play network or hardware wise and it only occurs with the enchanted video player on. Once the video starts playing it’s always direct play, no transcoding is in play.

After stumbling upon this buffering issue myself on an iPhone after a recent in-place upgrade from Server 2016 to 2019, I did some digging. Looking at a packet capture in Wireshark of a buffering stream, I noticed frequent TCP Retransmissions during that time and the RTO was 20ms.
After some research, I came across the Get-NetTCPSetting PowerShell command and found a very familiar number there. (Hint: It’s 20)

PS C:\WINDOWS\system32> Get-NetTCPSetting | ft -AutoSize

SettingName      CongestionProvider MinRto(ms) InitialRto(ms) CwndRestart DelayedAckTimeout DelayedAckFrequency AutoTuningLevelEffective
-----------      ------------------ ---------- -------------- ----------- ----------------- ------------------- ------------------------
Automatic
InternetCustom   CUBIC                     300           3000 False                      40                   2 Local
DatacenterCustom CUBIC                      20           3000 False                      10                   2 Local
Compat           NewReno                   300           3000 False                     200                   2 Local
Datacenter       CUBIC                      20           3000 False                      10                   2 Local
Internet         CUBIC                     300           3000 False                      40                   2 Local

From what I understand, by default, Windows classifies TCP connections automatically based on the initial RTT of the TCP handshake. You can read more about this at https://techcommunity.microsoft.com/t5/networking-blog/tcp-templates-for-windows-server-2019-8211-how-to-tune-your/ba-p/339795. For an iPhone and server on the same LAN, connections will typically follow the Datacenter setting. You can see this with the below command, substituting your Plex server port and client IP:

PS C:\WINDOWS\system32> Get-NetTCPConnection -LocalPort 32400 -RemoteAddress 192.168.0.150

LocalAddress                        LocalPort RemoteAddress                       RemotePort State       AppliedSetting OwningProcess
------------                        --------- -------------                       ---------- -----       -------------- -------------
192.168.0.149                       32400     192.168.0.150                       59518      Established Datacenter     6140
192.168.0.149                       32400     192.168.0.150                       50007      Established Datacenter     6140
192.168.0.149                       32400     192.168.0.150                       49926      Established Datacenter     6140

Now that familiar number of 20 appears under the Datacenter config as MinRto which is the minimum Retransmission timeout. So I tried increasing it to the max value of 300 using:

PS C:\WINDOWS\system32> Set-NetTCPSetting -SettingName "DatacenterCustom" -MinRtoMs 300
PS C:\WINDOWS\system32> Set-NetTCPSetting -SettingName "Datacenter" -MinRtoMs 300

After making this change and restarting my Plex client app on the iPhone, I no longer came across buffering nor TCP retransmissions after a few minutes of playback. Perhaps there are other parameters that can be tweaked, but this seems like a simple fix. Let me know how it goes for you.

PS, if you want to fully reset your TCP settings, you can run netsh int tcp reset.

9 Likes

Uh yes please. I will try this as soon as I get home tonight.

Thanks for posting this. I just made these changes and we’ll see if that does the trick.

I checked the TCP profile defaults with the first command, and they did match yours. I then checked TCP connections for one of my Apple TV 4Ks, and it was using the Datacenter profile as well. I then set the 2 profiles’ MiniRto to 300ms, restarted my server (and my Apple TV, for the hell of it), enabled EVC on the Apple TV, and testing a couple of videos out.

I started with the same video file I used for my original tests months ago, forcing PGS subtitles as well. Playback started high around 95 Mbps, but then smoothed out to a very constant 40 Mbps. That playback was so very steady at 40 Mbps, which was excellent. And, no buffering!

I then tested my most network intensive 4K movie, with PGS subtitles enabled as well, and the playback stream varies from 76 Mbps to 113 Mbps. Whatever the stream size, it played perfectly as well, even after 20 minutes of testing.

I will enable EVP on all my Apple TVs, but I’m very certain this fix will work. Since Windows Updates may change TCP stack settings, I know I can troubleshoot by checking the TCP profile settings.

@cursedZeroX, thank you so very much. I thought it was a network setting, but I didn’t go far enough in my testing, and never checked TCP profile settings. Hopefully this is the fix that will work long term.

1 Like

Glad it worked out for you. I watched from my iPhone for several hours yesterday with no buffering issues as well. Also, I saw the fix take effect once I restarted my Plex app on the iPhone. The TCP profile changes seem take effect on any new TCP connections, not existing, so restarting the server can be a quick fix for all your clients instead of restarting individual client apps in case there are any lingering connections.

@cursedZeroX Thank you for the fix. It seems to be working as expected. Do we know for sure that this won’t have any negative implications on the rest of my server’s functions? I use it as a file server, hyper-v server etc… Thanks!

Agreed that just restarting the Windows Server itself is the easiest way to ensure TCP connections get reset.

My server is used for more than just Plex, so I also need to see if the TCP change has any negative impact on anything like backups and other stuff (though I don’t think it will).

I did change the profile settings for both ā€œDatacenterā€ and ā€œDatacenterCustomā€ as you did, though is there a reason why you changed DatacenterCustom? I only ask because both of the Apple TVs I checked in my home were just using the Datacenter profile.

I changed them both just to be consistent, should only be necessary to change Datacenter.

this worked for me as well, i updated to June 2020 update on Server 2019 and have not had any issues. ty!

Just installed the July Cumulative updates, the MinRto settings stayed the same and didn’t revert back so that’s a good sign.

Same - tcp settings preserved after installing the latest updates.

1 Like

Since applying the changes recommended by @cursedZeroX, I have applied updates to Windows Server 2019, Apple TV, and the Plex client on Apple TV. MiniRTO settings have not changed, and everything still plays great with EVP enabled. I’ve marked the post by @cursedZeroX as the Solution.

Very nice troubleshooting process, explanation, and fix, @cursedZeroX.

Microsoft recently changed the default TCP congestion control algorithm for Windows 10 and Server 2019 to CUBIC. (Linux, Android, iOS & MacOS had already made that change.)

The Windows MinRtoMs default was also changed recently, when Microsoft enabled Hystart++. I’m not sure if it was done concurrently with the change to CUBIC or after. It is definitely related code.

Before seeing @cursedZeroX’s change, I was going to suggest reverting from CUBIC to the previous CTCP algorithm. That still might be worthwhile, because I’m sure Microsoft would take it very seriously: ā€œYou changed the default congestion control algorithm and broke basic TCP/IP interoperability!ā€

It could also be interesting if somebody with Server 2016 enabled CUBIC to see if that causes the same problem, for the same reason.

I think it’s very unlikely to have noticeable negative implications.

You probably aren’t getting all of the hypothetical benefits from Hystart++ on your home ā€œDatacenterā€ network. :slight_smile:

In the very worst case something else could break. I think that’s unlikely for several reasons -

Before the CUBIC and Hystart++ changes, before MinRtoMs was changed to 20, it was 300. So you had been using that value on your local network before Microsoft changed the default.

Additionally, the MinRtoMs value is still 300 for the other profiles. You have already been using that value to communicate with every other device on the Internet.

Mostly I wanted to say I’m impressed, @cursedZeroX.

3 Likes

I am having this identical issue with 3 Apple TV devices, an iPad, and an iPhone all in network. My PMS is running the latest Windows 10 build and I’ve had the weird delay playing videos for a while now and it drives us crazy!

So I was all excited when I saw a solution, then I ran the command and my TCP settings show everything PLEX in network and out of network it’s talking to is considered the INTERNET profile not data center. That’s surprised me, not sure if I should change anything or how I could get Windows or detect my in LAN subnet Apple devices as DataCenter not internet.

EDIT: I’ve found this is due to me having PMS installed on Windows 10 Pro, not Windows server. Windows 10 pro seems to default to Internet and I can’t use the following command due to OS restrictions. Now I’m really not sure how to fix this long tedious delay on the Apple devices.

New-NetTransportFilter -SettingName Datacenter -DestinationPrefix 192.168.XXX.0/24

@freezegunn47, can you share the output of Get-NetTCPSetting | ft -AutoSize please?