Sunday, August 17, 2008

performance problems with HD viewing in Media Center resolved

This is a follow up to my first three posts:
Vista View Saber DA-1N1-I tuner and Media Center
Vista 32-bit, First Impressions
Making Sense of Home Theatre PCs

Background
I had quite a battle over the past couple of days. The goal was to get a working Vista Media Center that did not choke while displaying live, HDTV content. First, I have to say that Microsoft has done a kick ass job with Media Center. It has taken a number of years, but the Media Center interface is really slick and easy to use, the content and functionality deep and the possibilities pretty open, given the way they've designed it. You can even download an SDK for it, which is cool.

In practice, however, getting Media Center to work on older equipment is challenging and frustrating for the newcomer. The interesting thing is the base system I started with ("started with"..yuk, yuk) was no slouch:

  • Dell 400SC, 3.2Ghz
  • 2GB PC3200 mem
  • 128MB ATI All-in-Wonder 9800 Pro AGP 4x card
  • 120GB 7200RPM IDE system drive

The Problem
The main problem was that when I viewed live HDTV channels, I would get drop outs and compression artifacts.

As you know, I had already completed the base Vista install, installed aVista View Saber DA-1N1-I tuner card and layered the latest and greatest Media Center with TVPack update on top of it.

There were a couple links to the Media Center TV Pack Unofficial Download on Engadget's site here. I've plucked out a couple of links to download TV Pack 2008 here, but I'm not sure how long they will be valid:
http://rapidshare.com/files/136020246/MediaCenterTVPack2008-KB953272-x64.zip.html
http://www.avsforum.com/avs-vb/showthread.php?s=b523af4d82ccee06f79c49badff6d2a9&p=14451290#post14451290
http://www.mediafire.com/?sharekey=30d15c758a398fcfd2db6fb9a8902bda
http://rapidshare.com/files/138029257/Media_Center_TV_Pack_2008.rar.html

The neat thing about TVPack with the Vista View tuner is that, among many other things it did, was resolve tricky problems with displaying the correct listings in the TV Guide if you have multiple channel sources (ie, cable and antenna signal inputs), as well as add support for clear QAM (quadrature amplitude modulation) channels. QAM channels are the HD channels that a TV provider will send "in the clear" over the cable line. In my case, Media Center sees about 14 clear QAM channels from Comcast.

Tuner Setup
I have a three way splitter in my upstairs loft that splits the cable signal three ways: one to the analog, NTSC connection on the TV tuner card, one to the digital, ATSC connection on the tuner card and one to the cable modem itself. Because I was getting drops, I thought that I was just getting a weak signal. I removed the splitter and plugged the feed directly into the digital connection on the tuner card. No luck, as the signal still broke up.

Initial Performance Stats
Taking a look at the new Reliability and Performance Monitor in Vista (quite nice, really) while an HDTV show was being displayed in MC, I saw that CPU was being driven close to 100% on my hyperthreaded system. Peaking on CPU is never good. I thought the problem could be my video card not offloading enough load from the CPU. Maybe the ATI card was unpowered to the task? I removed it and installed an NVidia 7600GS that I had laying around. Symptoms were the same with the new card.

So far, the evidence showed that the problem was not in the source signal or video card since:
1) the input source signal was clean
2) a capable video card was choking in the same way as an older one

Reviewing Performance Monitor, the disk seemed to be quite busy. I assumed this was due to the live tv buffer that MediaCenter keeps while you watch programs. To explain, MediaCenter has the same ability as a regular consumer DVR, in that it buffers live tv in order to allow the viewer to playback the last few minutes of a program. This rewind feature is supported by the system writing huge files to disk.

I should have pulled up some disk queue stats to confirm, but I had a gut feeling that the problem was in the disk subsystem. Looking at the disk reads and writes in Performance Monitor, I saw that about 4MB of data were being written to and read from the hard drive every second while an HD program was being shown. My current hard drive was a 120GB IDE. IDE throughput is pretty weak by today's standards. Hmmm..this old drive has to go. So, I was off to the nearest store to get a hard drive.

Throwing Money At It Will Solves the Problem!
*** BEGIN DIVERSION ***
In a pinch, Staples is my closest source of computer parts. Of course, it is not the best choice for prices. Oh well, I was on a mission. Seagate 500GB SATA..$130. Eeesh. That is a little too much. I patiently waited for the computer department rep to finish his conversation with another customer. I'm glad I did. I overheard that Staples supported price matching. I scrambled to find a machine with an open internet connection. Finding one, I Googled "site:bestbuy.com seagate 500GB SATA". Lo and behold, they had the very same drive for $90! Great! At the register, the clerk had to confirm the price. I noticed his point of sale system had web browsing directly built in. But he confirmed the price..$40 saved!
*** END DIVERSION ***

I ran home and installed the drive. Reading through the installation manual, I saw that Seagate has Disk Wizard, which allows you to format your new drive. It also had an option I hadn't seen before..to clone an older drives' contents onto a newer one. Psych! I was expecting to have to reinstall Vista, but if this Acronis clone software actually worked, I wouldn't have to go through that pain.

New Drive Fun
I installed the drive in the PC and got Disk Wizard running. Selecting the appropriate clone options, clone was to copy the old drives' content, sets the master boot record and reboot. Hitting "go", I saw that the clone ran very quickly, almost too quick, and then asked me to reboot. I figured the process must do the cloning on reboot, but when the box rebooted, the OS did not boot. Oh sh1t. I hope it hadn't blown away my Vista install. Googling for people with similar problems, I learned from someone else's issue that clone changes the master boot record, so my system trying to read off the new disk. Since the clone process didn't go as expected, there was no operating system for the master boot record to access. Luckily, clone did not touch the original system disk, so after unplugging the new one, I was able to verify my base Vista system was still alive.

Starting Disk Wizard again, I saw it had a bootable install version of the clone process. Since the initial Vista install process did not work, I thought I'd give this a shot. I burned an ISO to a CD and started up the clone process. This time, I saw progress on the clone procedure meter. It took about 17 minutes to clone 24GB of data from a 120GB IDE to my new 500GB Seagate. After the clone process was complete, the box rebooted. While the box rebooted, I made sure to shut down the box entirely and take the original system disk offline. After doing this, I restarted the system and was overjoyed to see Vista start booting. New drive works with my old install of Media Center! Yay!

Did the New Drive Help?
Moment of truth. I pulled up Media Center with some live HDTV. I still had dropouts even with the new, faster drive. Damn! OK. Since you can't turn off Live TV easily in MediaCenter (why would I want to, with Olympic Volleyball coming up?), I decided to meet the burden head on by using my old IDE RAID card and setup a stripe set of old hard drives. I had two 120GB lying around (the one old system disk plus another), so I installed the card, setup the RAID set in the BIOS and formatted the new RAID set when it came up in Vista. Voila! Lots of fast disk capacity on hand! Now to repoint the destination directory for the live hd temporary files to the RAID set.

Move those Temp Files!
In Media Center, I saw that there was no easy way to turn off the Live TV feature. So I figured the location of the temp file directory was in the registry. Reviewing the Disk statistics of Reliability and Performance Monitor more closely, PerfMon actually shows the location of the directory where disk access (reads and writes) are occurring. Sweet! Looking at the details of the offending process, I saw that this directory was the culprit of most of the reads and writes:
C:\Users\Public\Recorded TV\TempRec\TempSBE

Cool. I searched on this string in regedit, found the appropriate location:
HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\Media Center\Service\Video\Tuners\DVR\IO\Writer

Then, I tweaked the values to match a new directory that I setup on the D:. I restarted Media Center for the change to take effect and waited patiently for live HD to come up. Watching it, I saw that HD was definetly smoother, but not perfect. It still hiccupped from time to time. DAMMIT! Looking at the top CPU consumers in Task Manager, I saw that dwm.exe (Desktop Window Manager) kept popping up, albeit with low CPU consumptions of 5-7%. More performance tuning necessary.

Optimizing Media Center Performance
The key to getting Media Center working right is optimizing performance in Vista. Here are a few articles that helped me do that, in order of most useful:
ExtremeTech article
Andrew Grant's blog
APCmag.com article
Jwyse's blog

Also, the following article has some registry tweaks to get your Media Center setup just the way you like it:
MediaCenter.com.au article

One feature that I had kept running in Vista was the Aero interface with a sidebar of gadgets (clock, RSS news feed and rotating pictures). Apparently, the process dwm.exe controls the display of these visual effects and gadgets. In Control Panel -> Personalization -> Window Colors and Appearance, I disabled the Aero interface by selecting "Windows Standard" as the color scheme. After the change, I checked live HD. There were less drops, but still an occasional one every fifty seconds or so. Damn! On a hunch, I disabled the RSS news feed that was in the sidebar under the clock. Restarting Media Center, I watched for any live HD dropouts. One minute went by..no problem. Two minutes..no problem. Three minutes..no drops. Awesome! I think I've got the problem licked!

Right now, I've had live HDTV (the Olympics) running for four hours. There seems to be a barely noticeable lag sometimes when replaying the live HDTV buffer. I believe this is due, again, to disk access. I may add a third 7200RPM 80GB drive to my stripe set to improve performance. I will let you know how that goes.

Conclusions
In general, if you are skirting the edge of recommended hardware for HD viewing, Media Center seems VERY sensitive to any processes taking up CPU or mouse movements. Disabling any CPU performance hogs is essential in order to have live, HDTV in Vista Media Center run properly on an older system. If I want a perfectly clear HD viewing experience with no dropouts, I will not open ANY programs. Also, I don't have any programs running that update the display, like Task Manager or Performance monitor. In fact, I won't even touch the mouse if I want undisturbed video. Media Center a bit touchy, eh?

I assume if I had a new dual or quad core box with a fast CPU, the latest memory, a 1333Mhz front side bus, PCI Express video card and all SATA, I wouldn't have these problems. But I didn't feeling like paying an arm and a leg for a new box. With my trusty old Dell 400SC, I may be able to get by adding a $100 tuner and $100 hard drive only. Time will tell!

In sum, once Media Center is running well, it IS pretty sweet. Now to find a usable remote for VMC. Any suggestions?

:)

No comments:

Feel free to drop me a line or ask me a question.