In my previous post, I said that I had updated drivers and tweaked some settings to get pretty good 720p video playback on my HTPC. My HTPC is a couple of years old, so I'm still running an Athlon XP 3200+, 1 GB RAM, and a GeForce FX 5500 GPU.
I wrote about my "success" after watching the first 5 minutes or so of the last episode of Heroes with perfect audio/video sync. I got too excited (and posted declaring victory) after too little testing. When I tried watching other 720p videos later, they still experienced A/V sync problems (although not nearly as bad as they were before I started).
Tonight I did some more research and testing, and found another codec that seems to have fixed this issue (for real this time!). I had been using CCCP, which includes ffdshow, which uses the libavcodec for H.264 video. CoreAVC is another codec that several sources claim is the fastest H.264 codec available, and is at lest 30% faster than the libavcodec that I had been using. The CCCP folks have a pretty good wiki entry about why CoreAVC isn't included in CCCP, and how to use CoreAVC instead of ffdshow.
I tried it out, benchmarking my FPS before and after registering the new codec. I used this post as a general guideline to do the benchmarks using Media Player Classic (included in CCCP) and Fraps. I used the same 720p and 1080p sample videos links in the post. The videos have a framerate of 23.976 fps. My results (average framerates) for the 720p sample video are below.
libavcodec: 17.402 fps
CoreAVC: 23.983 fps
My 720p videos play like any others now, and I can skip forward/back without losing A/V sync. The audio plays immediately after the skip, and the video catches up and re-syncs within a second or two. My CPU utilization is quite a bit lower now too (it was 100% using libavcodec).
Unfortunately, the CoreAVC codec isn't free like ffdshow, but it's still cheaper than upgrading hardware.
Friday, May 04, 2007
HD Video Performance in Vista Media Center (Followup)
Posted by
jwyse
at
7:46 PM
0
comments
Labels: Media Center, Vista
Thursday, May 03, 2007
HD Video Performance in Vista Media Center
[Edited 2007.05.04: While I still recommend updating Windows/drivers/codecs anyway, it turns out that this didn't completely resolve my problem. Read my followup post for another codec option that performs much better and seems to have really resolved this issue.]
I was talking to James earlier this week about HD video in Media Center, and he warned me that 720p video performance is not that great (video is choppy and audio is out of sync) on his machine. He was giving me the heads-up because we have very similar HTPCs: I'm running Vista Ultimate on an Athlon XP 3200+; he's running XP MCE 2005 on an Athlon XP 2800+. Both have 1GB of dual-channel memory and similar (and quite modest) video cards.
I tried playing a 720p HD video on my machine tonight and saw exactly what he described, despite my slightly faster processor. My HTPC is a couple of years old, but it still runs great otherwise, so I'm not crazy about the idea of upgrading the hardware right now.
I was determined to squeeze acceptable performance out of my current hardware, so I started tweaking. I've now got the video running MUCH better, without any overclocking or outrageous settings (I even have Aero enabled). The video is smooth, and the audio and video are in sync, at least until I skip forward/back during playback -- and I suspect that a little bit more tweaking will fix that.
I took sort of a shotgun approach and changed quite a few things the first time around. All of these are changes that I wanted to make anyway, so I wasn't concerned with pinpointing which ONE change was the silver bullet.
- Added a 2GB USB flash drive and enabled ReadyBoost: Very noticeable improvement in the OS and Media Center interface, but no apparent changes to HD video playback.
- Ran Windows Update: There were no significant driver or Media Center-related updates available, but I needed to get the last batch of critical updates anyway. I don't think this had any effect on HD video playback.
- Updated my power settings from Power Saver (this must be the default, because I never would have chosen this option for an HTPC) to High Performance. In some configurations, the power settings throttle the CPU to conserve power, but since I don't have the AMD Cool 'n Quiet driver installed, I think it defaulted to maximum CPU power anyway.
- Verified that my memory was running in Dual Channel mode (it already was; no change here).
- Verified that I had the latest BIOS version installed (I already did; no change here).
- Updated CCCP (a pack of the most common audio/video codecs like DivX and Xvid) to the latest version.
- Stopped/disabled unused services like Indexing and Windows Firewall (the firewall was already "disabled," but the service was still running).
- Updated my video drivers to the latest version (Forceware 96.85, for my NVIDIA GeForce FX 5500).
I did a few quick tests along the way, and none of these changes noticeably improved playback until the last one: updating the video card drivers. The performance logs show that I still have very high CPU utilization during playback after these tweaks, but the audio/video is great now. I'd say perfect, but I need to do a little bit more tweaking so that I can fast-forward/rewind without getting the audio and video out of sync. Most of these changes should apply to both Vista and XP, and I'm curious to see if this fixes James' HD playback performance in XP MCE.
There are a couple more changes I can think of that might improve performance a bit more:
- Overclock the CPU/FSB/GPU in BIOS.
- Disable Windows themes (Aero/Luna): I'd expect a big improvement in most desktop applications, but I would hope that Windows isn't spending any CPU cycles rendering the theme while I have the Media Center application running full-screen anyway.
I've read some blog/forum posts that recommend setting the Enable Advanced Performance option in your disk write caching settings. This seems irrelevant (as far as video playback is concerned) because write caching shouldn't affect the disk read rate.* Disk access doesn't seem to be a factor in my case anyway, since I playback most of my TV shows from a mapped drive (a SATA disk in my server, mapped over my gigabit network). My tests tonight didn't show any difference between the network-mapped and local copies of the same video file.
A lot of this will depend on your hardware, but I read quite a few reports of people having this same problem with MUCH better hardware than what I'm running. Let me know if you have any other tips/recommendations to further improve HD video playback.
* At least not in my case, because this hard disk is dedicated to media, and no other processes are reading/writing to the disk while I'm playing video. If you have your media on disk shared with the OS or other applications, write caching might make a bit of difference for you.
Posted by
jwyse
at
12:12 AM
2
comments
Labels: Media Center, Vista
Blog Address Change
I've recently changed my blog address from jwyse.blogspot.com to blog.joshwyse.com.
You may want to update your links/RSS subscriptions to the new address to save yourself a redirect or two and speed up the loading of the page/feed.
Posted by
jwyse
at
12:01 AM
0
comments
Thursday, April 26, 2007
"Prepare this blank disk" in Vista
A few times recently I've popped a CD or DVD into one of my Vista machines, and it has popped up this message:
The only problem is... the disc in the drive wasn't blank. I've experienced this with at least two machines running Vista Business and Ultimate, 3 different CD-RW and DVD+/-RW drives, and at least a half dozen different professionally pressed CDs and DVDs -- so it wasn't a random read error or a dusty disc or anything like that.
Even more strange is the fact that I can "browse" the CD/DVD just fine from the command prompt using the good ol' dir and cd commands. This got me to the various setup.exe files that I was in a hurry to get to in the past, but tonight I took a few minutes to try to actually fix the problem.
Microsoft has a KB article that suggests some registry changes to the "lowerfilters" and "upperfilters" keys, but these didn't do anything for me.
The fix was pretty painless once I found it: just uninstall the affected devices from Device Manager and then Scan for Hardware Changes to re-detect them. It's a cheesy fix that should be entirely unnecessary, but it works, and it's easier than poking around in the registry.
I'd like to know more about the real underlying problem in Vista, but I'm not quite curious enough to track it down further since I've got my drives working properly now. If you happen to come across more information, please post a comment and let me know.
Posted by
jwyse
at
9:03 PM
16
comments
Sunday, March 18, 2007
Maintenance Plans in SQL 2005 Express
I use SQL Express on a few machines at home, and the one thing I'm missing in the Express Edition is the ability to automatically perform database backups/integrity checks/reindexing regularly with a Maintenance Plan. Since SQL Express doesn't have Maintenance Plans, it takes a bit of extra effort to set that up. Here's how I do it:
A Windows Scheduled Task runs daily, kicking off sqlexpressmaintplan.cmd:sqlcmd -S SQLSERVER\INSTANCE -i d:\scripts\sqlexpressmaintplan.sql
gzip -fNr e:\SQLBackups
(The second line simply compresses (using gzip) the .BAK files to conserve space.)
This executes sqlexpressmaintplan.sql, which has the configuration for my "maintenance plan". At a glance, it looks like a lot, but I've got it broken down into separate sections/tasks, so it's easy to comprehend and maintain.-- integrity check on system databases; save reports for 7 days
exec expressmaint
@database = 'ALL_SYSTEM',
@optype = 'CHECKDB',
@reportfldr = 'e:\SQLReports',
@rptretainunit = 'weeks',
@rptretainval = 1,
@report = 1
-- integrity check on user databases; save reports for 7 days
exec expressmaint
@database = 'ALL_USER',
@optype = 'CHECKDB',
@reportfldr = 'e:\SQLReports',
@rptretainunit = 'weeks',
@rptretainval = 1,
@report = 1
-- reindex my database; save reports for 7 days
exec expressmaint
@database = 'MyDatabase',
@optype = 'REINDEX',
@reportfldr = 'e:\SQLReports',
@rptretainunit = 'weeks',
@rptretainval = 1,
@report = 1
-- backup system databases; verify; save backups for 2 weeks; save reports for 7 days
exec expressmaint
@database = 'ALL_SYSTEM',
@optype = 'DB',
@backupfldr = 'e:\SQLBackups',
@reportfldr = 'e:\SQLReports',
@verify = 1,
@dbretainunit = 'weeks',
@dbretainval = 2,
@rptretainunit = 'weeks',
@rptretainval = 1,
@report = 1
-- backup user databases; verify; save backups for 4 weeks; save reports for 7 days
exec expressmaint
@database = 'ALL_USER',
@optype = 'DB',
@backupfldr = 'e:\SQLBackups',
@reportfldr = 'e:\SQLReports',
@verify = 1,
@dbretainunit = 'weeks',
@dbretainval = 4,
@rptretainunit = 'weeks',
@rptretainval = 1,
@report = 1
The real magic happens in the expressmaint stored procedure, created by SQL Server MVP Jasper Smith. (Also available as a standalone executable.) You can read more about this great tool on sqldbatips.com in two articles covering the stored procedure and the standalone app.
It's been a really long time since I originally set this up, and I'm having to revisit it now (and write about it) because I just rebuilt my primary workstation and server at home. Now that I'm reading back over this article, I can't remember why I chose to use the stored procedure instead of the executable version -- the exe would be a bit easier to drop into place, along with the batch file (the SQL script would no longer be necessary), next time I have to set this up on a fresh SQL Express install. I'm going to try out the executable version this time around to see if it's any easier to set up and maintain (it looks like it will be).
Thursday, March 08, 2007
Re-Arming Vista's Trial After Expiration
Windows Vista can be installed without a product key in a 30-day trial mode. This is nice for users who may want to try out Vista, or compare the different flavors (Home Basic, Home Premium, Business, Ultimate, etc). After 30 days, you are required to activate Vista by entering a valid product key, which will then lock it in to a particular edition depending on the key (Vista also supports instant upgrades, so you can change editions later).
As Jeff Atwood points out, you can extend the grace period to 120 days using the re-arm command. It's easy, it's legal, and it's provided by Microsoft. And ideally, you'll extend the grace period BEFORE the 30-day trial is up.
My Vista 30-day trial ran out on my media center PC, and I was given only four options the next time I tried to login: activate now, re-enter my license key, use reduced functionality mode, or logout. I'm not ready to activate, and I don't have a license key. I don't want to logout -- I want to watch TV! This leaves "reduced functionality mode," which is only an IE browser window (you're supposed to use it to buy Vista online). I remembered the re-arm command, but reduced functionality mode doesn't provide a Command Prompt, the Start Menu, Desktop, or anything else -- just a single IE window.
Fortunately, there's an easy workaround (or maybe several. Safe Mode seems like a reasonable option, but I didn't want to reboot). IE's address bar can be used to browse the file system to open web pages stored locally. It can also be used to launch c:\windows\explorer.exe, which starts up the rest of the Windows environment and gets you out of reduced-functionality mode. From there, I opened a command prompt with elevated privileges and ran "slmgr -rearm" to extend the trial period by another 30 days.
Posted by
jwyse
at
8:03 PM
3
comments
Wednesday, March 07, 2007
Visual Studio 2005 SP1 for Vista
Visual Studio 2005 Service Pack 1 is finally out of beta. Remember to uninstall the beta (listed under "updates" as Hotfix for Visual Studio 2005 [SKU name] - ENU (KB929470)) first.
Posted by
jwyse
at
12:11 PM
0
comments
Labels: .NET, Development, Vista, VS2005