Improving the movie library performance


Some time after you have started to archive your recordings and you have converted them into a movie library, you will notice that the performance slowly degrades. Specifically, when you switch the view from ordering by title to genre, year or rating, you are likely to experience a significant delay. With hundreds of recordings, the delay will be so drastic that you will likely refrain from using any other ordering than title altogether. When I first noticed this, I thought that my old machine was simply too slow to handle the parsing of the meta data files. However, since I recently bought a faster replacement that still exhibits the same problem, I started the bug hunt.

windows-media-center-waiting

Windows Media Center: Don’t disturb, it is still doing something

In order to see what Windows Media Center was doing, I used the Windows Task Manager to check its resource accesses. Stunningly, I saw network traffic originating from Windows Media Center’s ehshell process. In order to see what it was doing, I installed Microsoft’s Network Monitor and started a packet capturing session. After some time I figured that Windows Media Center was issuing meta data requests, despite the fact that I had all the meta data on disk already. In order to understand what was going on, I put a DVD into the machine and to my surprise I saw that Windows Media Center’s handling of meta data is slightly more complicated than I though.

network-monitor-ehshell

Microsoft Network Monitor: A nutty ehshell on its way out …

Instead of solely retrieving and storing meta data on disk in one shot, Microsoft apparently runs a number of web services to retrieve additional information on demand via SOAP requests. So when you press OK on a particular movie, Windows Media Center will contact a service to retrieve the movie cast, a movie critique or names of similar movies. Thereby, it uses the DVDID as its search key. If you have been using DVD Library Manager or a similar tool to generate the meta data for your recordings, the DVDIDs associated with your movie will likely be invalid. Consequently, any access to Microsoft’s web services will fail and thus, it will not generate additional information. Besides, even if it did, chances are that it would not provide the correct one.

Although, issuing failing requests is suboptimal, it is generally not harmful in practice. In order to save resources, Microsoft presumably designed the title ordering in such a way that is operates directly on the meta data on disk. Consequently, a failing request is only issued once you display the movie details. For whatever reason, however, when switching to genre, year or rating ordering, Windows Media Center decides to start a series of requests for each and every movie in the entire library. With a large number of movies in the library, this can easily take up to a few minutes. Once the requests fail, Windows Media Center happily uses the information contained in the meta data on disk to sort and display the movies properly. Isn’t that funny, not?

Given this behavior, there are several ways to handle the situation. First, you can simply stop using the built-in movie library and switch to some third party plug-in. After browsing several forums and news groups, this seems to be the most common approach. Second, you can spend more money for a low latency and high bandwidth Internet connection to speed up the failing SOAP calls. Third, you can make the requests fail locally, so that they are never sent out. If you are happy with option one and two, stop reading. In the following, I will focus on the third option.

nslookup-windowsmedia-metaservices

Domain Name Lookup: Getting the IP of the root of all evil

A closer analysis of the traffic reveals that Windows Media Center is retrieving metadata from a server named metaservices.windowsmedia.com. Using nslookup, it is trivial to figure out that this name currently resolves to the IP address 65.55.13.252. The next step is to make the IP address inaccessible to Windows Media Center. To do this, you can either configure your router to block the IP for all devices on your network or you can simply define an additional rule in Windows Firewall. In the following, I briefly outline how to do this. First, open the Windows Firewall settings in administrative mode. Click on outgoing rules on the left pane and press the add button on the right pane.

windows-firewall-rule-wizard

Windows Firewall: Just block the IP for access through ehshell

On the first wizard page, select the user-defined rule option. On the second page, select this program and type %SystemRoot%\ehome\ehshell.exe into the text box. On the third page, keep all protocols and continue. On the fourth page, select specified remote IP addresses on the lower part of the page and add 65.55.13.252. On the fifth page, select block connection and on the sixth page, just keep everything. Finally, on the seventh page, name the rule with an arbitrary name and you are done. Feel free to enjoy a really fast movie library.

Possible caveats: Chances are that the IP address for metaservices.windowsmedia.com might not remain static. If you experience bad performance, rerun nslookup and check whether the address has changed. If it did, just adapt the firewall rule. Furthermore, although, I have made some experiments with this setup, I am not sure whether blocking of the meta services interferes with other part of Windows Media Center. It does not seem to affect the EPG, but it might block music meta data services as well.