I just discovered a very useful command in Windows: ForFiles. It's used to iterate over files from the command prompt (and much easier to use than the for command, when it comes to manipulating files), and even processes some criteria.
I just used this command to cleanup old (/d -30; older than 30 days) gzipped (/m *.gz) files in the path (/p) e:\tempfiles and all subdirectories (/s). For each file, it issued the command (/c) to echo the filename to the command window (so I could see which files were being deleted) and then delete the file.forfiles /p e:\tempfiles /s /m *.gz /d -30 /c "cmd /c echo @file & del @file"
Check the Microsoft TechNet documentation for complete usage information and some more examples. If you don't already have the ForFiles command in your version of Windows (I know that it's included in Vista and Server 2003 SP1, but not XP SP2), you can get it from Microsoft's FTP site under the NT 4.0 "y2kfix" Resource Kit files.
[EDIT 2007.05.14: Apparently I posted the wrong MS FTP link. Thanks to Daniell for pointing this out and sending me the corrected link.]
Monday, May 07, 2007
ForFiles Command
Posted by
jwyse
at
10:13 AM
3
comments
Friday, May 04, 2007
HD Video Performance in Vista Media Center (Followup)
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.
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