Improve Remote Desktop frame rate to 60fps by enabling AVC 4:4:4 encoding

I am a great fan of Remote Desktop and have been using it for over a decade. It’s built in and just works. One gripe of mine has always been the poor framerate which makes animations and transitions super janky by default.

In RDP 10 it turns out this can be massively improved by enabling a screen encoding based on AVC/H.264 video. By enabling the group policy “Prioritize H.264/AVC 444 graphics mode for Remote Desktop Connections” under Computer Configuration > Administrative Templates > Windows Components > Remote Desktop Services > Remote Desktop Session Host > Remote Session Environment, I was able to get a glorious 60fps, almost double what I was getting before.

There is also another group policy to use your GPU to do the encoding, “Configure H.264/AVC hardware encoding for Remote Desktop connections”. Turn this on and you can see your GPU in task manager doing a little bit of work to encode the video, potentially saving the CPU from some effort. However in my testing I actually saw slightly worse performance in this mode, as you can see from this video:

Improve Remote Desktop frame rate up to 60fps!
Watch this video on YouTube.

I do wonder why this option is buried in Group Policy and not more user accessible – it appears to be enabled by default in cloud hosted environments with virtual GPUs (such as the Azure GPU instances). I also wonder if you can actually game using it?

Missing StoreKey PFX certificates when building a Visual Studio 2019 UWP project

I came across an interesting issue updating my UWP app to Visual Studio 2019 and a new Azure DevOps pipeline. “Associate with Store” no longer adds password-less PFX files named *TemporaryKey.pfx and *StoreKey.pfx to your project to sign your store submissions – instead in VS2019 it now adds the certificates to your local user store only.

Which means when it comes to build, you get errors like

C:\Program Files (x86)\Microsoft Visual Studio\2017\Enterprise\MSBuild\Microsoft\VisualStudio\v15.0\AppxPackage\Microsoft.AppXPackage.Targets(4353,5): Error APPX0102: A certificate with thumbprint '' that is specified in the project cannot be found in the certificate store. Please specify a valid thumbprint in the project file.
C:\Program Files (x86)\Microsoft Visual Studio\2017\Enterprise\MSBuild\Microsoft\VisualStudio\v15.0\AppxPackage\Microsoft.AppXPackage.Targets(4353,5): Error APPX0107: The certificate specified is not valid for signing. For more information about valid certificates, see http://go.microsoft.com/fwlink/?LinkID=241478.

For comparison:

Above: Visual Studio 2017

Above: Visual Studio 2019 – notice the options to select from file and create test certificate are no longer.

To fix this for Azure Devops, you’ll need to install the PFX private key on every build. Follow these steps:

  • On the Choose Certificate window (shown above) choose View Full Certificate
  • On the second tab, choose “Copy to file…” to start the export to PFX process
  • Export the private key to a password protected PFX file
  • Add the PFX file to your project directory, like where it used to be in VS 2017
  • Update your .csproj file, adding a <PackageCertificateKeyFile> element containing the filename alongside <PackageCertificateThumbprint>
  • Add your PFX to source control making sure it is not ignored
  • In Azure Devops Pipelines, you’ll need a quick Powershell build step to add the certificate to the local user store:
  • Make sure that the WorkingDirectory option is set to the folder with the PFX file (alongside the .csproj) file.

That Powershell script in full:

$pfxpath = 'MySigningKey.pfx'
$password = 'supersecretpassword'

Add-Type -AssemblyName System.Security
$cert = New-Object System.Security.Cryptography.X509Certificates.X509Certificate2
$cert.Import($pfxpath, $password, [System.Security.Cryptography.X509Certificates.X509KeyStorageFlags]"PersistKeySet")
$store = new-object system.security.cryptography.X509Certificates.X509Store -argumentlist "MY", CurrentUser
$store.Open([System.Security.Cryptography.X509Certificates.OpenFlags]"ReadWrite")
$store.Add($cert)
$store.Close()

Now when your app is built, the private signing key will be loaded from the local machine store.

A note on security

The above is a quick and dirty way of getting this working – adding a PFX file to your source code repository is not best practice and you shouldn’t do this if you can help it. This is probably why Microsoft changed this behaviour in VS2019. An improvement on this could be to use the Secure Files feature of Azure DevOps to securely hold the PFX file until the build templates have a decent way of handing this scenario.

 

 

 

 

An ode to Surface 3

It is increasingly looking like the Surface 3 is going to be discontinued. Microsoft is running out of stock on the 128GB / 4GB RAM model. Third party vendors are heavily discounting it, suggesting a clearance. The biggest sign of its demise is that Intel are simply going to stop making the quad-core Cherry Trail Atom processors that power the Surface 3 and other tablets like it.

This is a crying shame. The Surface 3 (not to be confused with the larger, laptop-class Surface Pro 3) is simply a fantastic tablet device.

The history

Surface 3 was the successor to the Surface 2, which followed on from the Surface RT. Both Surface RT and Surface 2 were powered by ARM chips and a limited, cut down version of Windows, Windows 8.1 RT. They were never eligible for an upgrade to Windows 10 (although the work done to enable Windows-on-ARM lives on in Windows 10 IoT). The market also shunned them and customers were confused by them. I was in New York for the launch of Surface RT, picked one up and loved it. I however personally witnessed customers, after queuing for an hour to get into the pop-up Microsoft Store in Times Square, decide to leave empty handed when they found out that the Surface RT wouldn’t run iTunes. Strangely the Surface Pro, which would have run iTunes, had its release staggered to a few days after the RT launch. I believe this caused significant confusion and prevented the Microsoft Store staff from successfully upselling.

Surface RT was a fantastic device for its time, albeit with serious flaws. I loved the fact it was a perfect Remote Desktop machine, but aspects like the custom charger and stupid 16:9 aspect ratio took until the Surface 3 to resolve.

The hardware

The Surface 3 is a real PC, well crafted for the price point. Some of my favourite features of the hardware are:

  • Mini USB charging port – you can charge this thing with almost any cable or charger you already have lying around, including USB charging battery packs. This makes it extremely easy to travel with. The Surface 3 is the only Surface (including RTs and Pros) ever made with a standard, universal charging connector.
  • Stylus support – one of the USPs of the Surface Pro VS the Surface RT was the fact the Pro had a Wacom stylus and digitizer. It took until the Surface 3 for the non-Pro line to get a stylus to match the Pro line. Although you do need to buy the pen separately, the pens are the same across Surface 3 and Pro (which has a pen bundled). I have a feeling this might have cannibalized sales of the Surface Pro 3 and 4.
  • USB 3 port – Pretty much peripheral ever made for a PC works with the Surface 3.
  • DisplayPort connector – you can plug directly into a large monitor with dual screen support.
  • Kickstand – this is unbelievably useful on airplanes and something that Apple is too proud to add to the iPad without resorting to flappy, folding cases. Without the keyboard attached this enables hands-free viewing in a really small footprint.
  • Expandable storage – you can bung a micro SD card in the slot in the back to expand the storage.

None of the above features are available on non-Pro iPads without accessories and dongles. Stylus support is limited to the iPad Pro.

The software

Whilst it shipped with Windows 8.1, the Surface 3 now runs Windows 10 like a charm. Some of the best bits:

  • Battery Saver mode – this really works. It shuts down background processes (even Windows Updates!) and underclocks the CPU. I have seen the Surface 3 stretch to around 10 hours of use when browsing with Battery Saver turned on.
  • InstantGo/Connected Standby – Surface 3 picks up emails and Skype calls when in standby mode. It does actually work.
  • Real Chrome – because this is a real PC, you can run full Chrome with extensions. Hilariously, Chrome had better support for tablets than Microsoft Edge until the Anniversary Update – Chrome supported swipe left/right for back/forward when Edge did not. iPads are limited to a fake Chrome (Safari in a wrapper) with no extension support.
  • Legacy software – Microsoft Money still works on this, a program Microsoft stopped supporting in 2008.
  • Native support for FLAC and MKV – one of my favourite features of Windows 10 is built in support for FLAC, the most popular lossless audio encoding format, and MKV, the most popular HD video format container. Apple still does not have native support for these in macOS or iOS.
  • Multiple user accounts – unlike an iPad, you can actually have multiple user accounts with separate settings etc. You can create user accounts for your spouse and children without the ability to administer the device. I believe Apple’s solution to shared devices is to, er, buy another one.

The only real downside is because of the slow eMMC disk speed, Windows 10 baseline version updates can take over 2 hours to install.

Pricing and comparisons to iPads

Surface 3 in the UK comes in two main models:

  • 64GB Storage, 2GB RAM – 419.99 GBP
  • 128GB storage, 4GB RAM – 499.99 GBP

I own the second model, purchased at the Hawaii Microsoft Store for 599 USD, along with a US layout type cover at 129 USD and a stylus at 49 USD. This was a total of 540 GBP at the time, so thanks to the exchange rate I essentially got the type cover for free.

If you want to buy an iPad with 128GB storage, this will cost you 619 GBP for the 9.7 inch iPad Pro. The iPad Air only goes up to 64GB for 429 GBP. You still don’t get a kickstand, expandable storage or even a USB port. iOS doesn’t even support a mouse, Bluetooth or not, forcing you to get gorilla arm when using it with a keyboard attached.

At under 500 quid, this is a feasible device to travel with and not have your holiday ruined if you lose it. I cannot find any justification to get a Surface Pro 4 at double the price for the mid-range i5 / 8 GB RAM / 256 GB storage model. After using a 13 inch MacBook Pro as my main machine for three years, I’ve now offloaded the Mac and returned to the state of having a beefy desktop and cheap, portable companion tablet PC. I was sorely tempted by the Surface Book, but for the two thirds of the price you can build a beast desktop and get a Surface 3 or other companion device for portability, just using Remote Desktop if you need to connect back to base.

For those who don’t mind Windows and want a companion device, I really recommend getting a Surface 3 whilst you still can. They were/are truly revolutionary at their price point.


Shameless plug: This post was written with Net Writer – a little app I wrote to help blogging on Windows 10. If you have Windows 10, download it for free.