Sunday, April 24, 2016

Media Center on Windows 10 Fixes (DVB-T, Scheduled Recording and ehrecvr.exe Fix)

Gday again.

Well the time has hit to use pleb TV again in Australia (thanks Masterchef) so I thought I'd get good old Media Center going on Windows 10.

As it turns out, Media Center is no longer part of Win10 by default.

Luckily, you can still manually install it.
Head to the http://lifehacker.com/get-windows-media-center-running-on-windows-10-with-a-f-1729919907 for more details.

Once installed, you'll hit a few small issues.
Below is a list of these issues and how to resolve them.


Live TV Doesn't Work (Codec Issue)
By default Windows 10 doesn't have the necessary codecs to decode a DVB-T stream.

This is easily fixed by downloading and installing the LAV filters pack available at:
https://github.com/Nevcairiel/LAVFilters/releases

Recordings Don't Start (Permissions Issue)
It appears Media Center uses task scheduler to manage recordings.
Win 10 uses different privileges for different users and it appears the standard account doesn't have rights to create scheduled tasks.

This is easily fixed by changing the program shortcut settings under the compatibility tab to make sure that the program is always run as an administrator.

Machine Unresponsive (CPU gets hammered by recording service)
It appears the gem that has plagued media center from day one still exists.

Anyone who has used MediaCenter has probably experienced the issue where you get 100% CPU usage on all cores by a little bastard process called ehrecvr.exe.
As an added bonus, it also sets it's priority to above normal, which makes it even more prone to CPU chomping.

This is the service used by Media Center to record shows, so  it's sort of important.
It's clearly a bug that has never been resolved by MS.

Luckily, there's absolutely no need for this service to require that much CPU so we can limit how many cores it can use (one) and set its priority to normal (instead of all).

Note - through my testing, you have to have ehrecvr bound to core 1.
You can give it more than one core, but one of the cores must be core 1.
If you don't, recordings won't start.

To bring this sucker under control, first you need the ehrecvr service to start.
The only way to do this without confusing Media Center is to let Media Center be the reason it starts.

I put a shortcut to Media Center (set to run as administrator) in my Startup folder to make sure it kicks off at boot.

Next, create a batch file with the following lines and save it somewhere:

wmic process where name="ehrecvr.exe" CALL setpriority "normal"
PowerShell "$Process = Get-Process ehrecvr.exe; $Process.ProcessorAffinity=1"

Note - the processor affinity value indicates which cores to use.
For this exercise, one core is fine but if you want you can give it two cores.

Values are as follows:
Core 1 Only: 1
Core 1 and 2: 3
Core 1 and 3: 5
Core 1 and 4: 9

Next, create a scheduled task with the following settings.

General Tab: 
Run whether user is logged on or not: Checked
Run with highest privileges: Checked

Triggers:
Begin the Task: At Startup
Delay Task For: 1 Minute

Actions:
Point it to your batch file.

And that's it :)

You should now have a full functioning install of Windows Media Center on Windows 10 that doesn't cause weird performance issues.

Enjoy :)









1 comment: