User Guides HowTo: Hardware decode H.264 streams (MKV)

Hardware acceleration of H.264 streams in MKV containers

With the arrival of nVidia G92 architectures (8400/ 8500/ 8600/ 9xxx models, to name a few of the most popular cards), a lot of us became aware that cheap hardware acceleration of HD streams was now feasible. Some of us (which included me till very recently) may even believe that 'it just works', based on the many advertisements and sometimes incomplete information spread by the manufacturers.

How do you know whether hardware acceleration is working for you? You know because there's no in-between CPU utilization if you've got hardware acceleration functional on your system. If your machine is rendering HD in software, you'll see CPU utilizations anywhere between 30% and 100%, depending upon your machine and codec; if you have hardware rendering, you'll normally be at less than 10%. To illustrate, my CPU utilization on a C2D E6400 stock-clock came down from 90% while rendering a 720p movie to ~5%. I uninstalled my sound drivers, and CPU utilization was... zero! I'm not joking. It's amazing to watch a 720p video stream play silently while the Task Manager tells you CPU utilization is zero. With sound drivers and a fully functional system, ~5% is pretty normal, and this doesn't go up if you play a 1080p stream instead. So stable CPU utilization >30% (or even 20% on a high-end machine) is usually a good indicator of software-based rendering.

What are the facts? The facts are:
1. nVidia and ATi have introduced cards that permit hardware acceleration (nVidia through PureVideo and ATi through the AVIVO implementation);
2. These features are exposed to software players by way of DirectX acceleration (DXVA) implemented in the graphics drivers (read: no need to buy something extra from the manufacturer)
3. However - and this is the critical issue - the player must support DXVA acceleration to be able to make use of this functionality. Also, the primary codec the system defaults to should be one that works with hardware acceleration. If one has a software renderer like FFDShow or CoreAVC as primary, the hardware acceleration will not function.
4. This problem is usually limited to MKV playback, since if you've got WinDVD/ PowerDVD installed on your machine, they are able to recognize any HDDVD or Blu-Ray disc you may have inserted, and are able to use the right codec to permit hardware acceleration. The problem with MKV comes from the fact that these software don't recognize MKV containers and therefore don't accelerate the H.264 stream that emerges from it.

So, which players permit DXVA acceleration? Based on what I've done, PowerDVD 8 Ultra definitely works, and from what I read, WinDVD 9 should work, too. Other than that, you'll need to do some reading - the player will clearly state support for either/ and PureVideo and AVIVO.

Note - this doesn't mean one has to use that player; if you prefer Media Player Classic or ZoomPlayer, you can use that for regular playback, as long as you've got the PowerDVD/ WinDVD software installed. Since most popular players (MPC etc) are DirectShow based, they can use the highest priority codec (eg, the PowerDVD hardware accelerated codec) once it's been installed and set up right.

Having got all the conceptual stuff out of the way, let's get to the how-to part. The process stated below is the one suitable for most neophytes; advanced users who understand what they're doing need not uninstall the software renderers, and can reduce them in priority or block them out from the player instead. I assume you already have your latest graphics drivers installed.

Steps:
1. Uninstall all the codec packs (KLite, CCCP, to name two of the most popular).
2. Uninstall any implementation of FFDShow or CoreAVC that may be installed.
3. Try playing an MKV or other HD file... if you've done this right, it shouldn't play. ;-)
4. Install the player of choice (WinDVD or PowerDVD or whatever else you've identified for yourself).
5. Download MatroskaSplitter from SourceForge.net: Files
This is version 1.0.2.9, which is currently the latest. A newer version may be available by the time you read this.
6. The download will be a file with the .ax extension. Copy it to c:\windows\system32 (or wherever your Windows\system32 folder is located), open up a command line, and type: regsvr32 matroskasplitter.ax <Enter>. This will register the filter, and make it available for use to the system.
7. Download Media Player Classic Home Cinema ed 1.1.604 (this is my favourite; feel free to use any other player you like) from http://mpc-hc.sourceforge.net/
8. Right-click the file you want to play and associate it with the player of your choice.

You may need to re-install AC3Filter (AC3Filter) if you have a problem with the sound after uninstalling the codec packs, but that should fix everything.

Hope you find this useful... cheers and best wishes!
usb101

PS: Thanks to RpOk for getting me started on TechEnclave and putting me onto a lot of the stuff you see in this post.
PPS: My first post, so forgive errors and suggest improvements - I'm a reasonably fast learner. :D
 
nice guide usb - welcome to TE :) Getting reputation points from your first post - nice way to say 'hello world' :p
Thanks for helping me get 0% cpu usage while playing 1080p streams on my pc :)
This is a very good knowledge if you want your htpc to play 1080p streams without paying for the fast cpu...just get a 8600gt or equivalent card and you're done.
200mph, you might not know, but even usb's hd collection is a part of our Delhi HD pool funded by switch, me, him and you.
 
Well, i removed my CoreAVC and XviD codec including AC3. Rebooted. Did a registry cleaning. Rebooted. Did all the steps u said but it didn't work.

Now the CPU utilization is reaching 100% for 1080p video. Even after installing CoreAVC again, the CPU usage which used to be ~30% is now 100%. God damn it. I don't know but something did mess up completely. Any suggestions?
 
Hi, people.

Thanks for the encouragement.

200mph - thanks for the collection; the only reason there was no mention was that the article was on this slightly different subject which we've been researching for the past couple of days.

@broar94 - absolutely correct, no real need to uninstall cccp. But having DXVA support and getting the right codec to get used for rendering are very different animals. You may have the level of knowledge required to set priorities and block the wrong 'uns, but the noobies may not... and at the end of the day, if the chap is able to play his HD stuff with hardware acceleration without CCCP, where's the loss? ;-)

@BacktoExistence - thanks, amigo.

@HTPC - I'm wondering whether it'd make sense to set it up on Vista rather than WinXP. The instant on feature is one a chap could easily come to love, esp for HTPC use. Press the button, wait one second by the watch, and the system switches off for all intents and purposes - cabinet fans, proc fan, graphics card fan... you name it, everything's dead. Come back after an hour, press the button, wait a sec, and you're on the login screen. Hibernate takes forever with 4GB of ram... Vista seems to be growing on me (x64 SP1).

Right now I'm trying to get my Vista install to replicate the WinXP results - down to 30% CPU use after the first effort, but some way to go. If I need to use a different combination for Vista, I'll add a comment.

Cheers, people...
 
clown_abhi said:
Well, i removed my CoreAVC and XviD codec including AC3. Rebooted. Did a registry cleaning. Rebooted. Did all the steps u said but it didn't work.

Now the CPU utilization is reaching 100% for 1080p video. Even after installing CoreAVC again, the CPU usage which used to be ~30% is now 100%. God damn it. I don't know but something did mess up completely. Any suggestions?

Hi.

If the system is playing HD, there's some H.264 codec left that didn't get uninstalled... the fact that CoreAVC does not help your CPU utilization means that the other codec still in there is taking precedence and CoreAVC is doing nothing more than a vague twiddling of the thumbs with an occasional yawn.

Which version of PowerDVD/ WinDVD did you install?

I'd suggest using Graphedit (GraphEdit | Software - Digital Digest) to play your file. It'll give you a visual representation of the splitter, audio and video codecs being used to playback the clip. After you've uninstalled everything and installed only the software mentioned in the guide, you should be using the MatroskaSplitter splitter, PowerDVD H.264 decoder, and your device out (for the video path... audio path is irrelevant for now).

Could you share:
1. Which player you're using;
2. The splitter and decoder that Graphedit reveals.

That'd help possibly troubleshoot the problem...

Cheers!
usb101
 
rPOk said:
nice guide usb - welcome to TE :) Getting reputation points from your first post - nice way to say 'hello world' :p

Thanks for helping me get 0% cpu usage while playing 1080p streams on my pc :)

This is a very good knowledge if you want your htpc to play 1080p streams without paying for the fast cpu...just get a 8600gt or equivalent card and you're done.

200mph, you might not know, but even usb's hd collection is a part of our Delhi HD pool funded by switch, me, him and you.

hehe i was joking re :cool2: , hehe , well i was going to get a lot of HD stuff this month end :D so a MEET is a must :D :D
 
usb101, if you'd be kind enough to also post a screenie of graphedit for various types of HD material (WMV, MPEG4, et al) on your WinXP installation, it would be a great help :)

Repped you for a great writeup :hap2: . Hope to get this working on my system.
 
nfsfan said:
that means one doesnt have to even download/install purevideo HD/avivo?

not exactly.. you wont the downloading and installing purevideo HD/avivo decoders.. but you sure WILL need to install powerdvd/windvd which come with their own HD hardware acceleration drivers..
 
WickedTA said:
usb101, if you'd be kind enough to also post a screenie of graphedit for various types of HD material (WMV, MPEG4, et al) on your WinXP installation, it would be a great help :)

Repped you for a great writeup :hap2: . Hope to get this working on my system.

Will do... give me a couple of days - I'm not in town and will get back to my desktop by Sunday.

Cheers!
 
sTALKEr said:
not exactly.. you wont the downloading and installing purevideo HD/avivo decoders.. but you sure WILL need to install powerdvd/windvd which come with their own HD hardware acceleration drivers..

No need to set up purevideo/ avivo drivers separately? Yes and no. Let's talk PureVideo first - it's integrated into the nVidia driver install, so one doesn't really have a choice. AVIVO... is available as a separate download for ATi. If one were to just install the WDM drivers and not the full suite, I don't think the hardware acceleration would work. Having said that, I'm sure sTALKEr is right to the extent that one is not really installing H.264 'decoders' when one installs the full driver suite.

Conceptually, if one were somehow able to present the H.264 'decode' as a rendering problem to the GPU, the GPU would 'render' the H.264 stream much like it would render any other video stream that the CPU sent it. This is pretty much what DX10 compliant boards are able to do, since the unified shader architecture with branching and streaming logic permits the flexibility to run H.264 decode as a render process (at least, this is my understanding).

The DirectX architecture insulates the application (MPC, WinDVD, whatever)from the hardware... this would imply that regardless of whether it's nVidia, or ATi, or Intel integrated for that matter, the decode codec passes the same DirectX calls to hardware. Either the hardware supports it, in which case the hardware acc. will work via the relevant codec... or the hardware won't support the call, in which case the system will default to the software codec (if one exists) else give you an error.

So the way this works, at least in my mind, is:
1. Application gets an H.264 stream (via Matroska Splitter if it's an MKV, or through it's own splitters if it's BluRay etc).
2. Application passes it to the highest priority DirectX filter. (which is the hardware acceleration one if we've got it right - this one won't initialise if the hardware doesn't support it)
2a. As a corollary, if the highest priority DirectX filter is a software codec like CoreAVC, the system will render the stream in software, which is why all of us are working so hard at making sure the darned system doesn't do anything that stupid when a perfectly good 9600GT (for me) is sitting idle. ;-)
3. DirectX filter passes the stream to the GPU by way of the DirectX drivers (PureVideo/ AVIVO software that activates the video processing capabilities on the chip).
4. GPU renders the stream and puts it on the display.

This is how I think it works... maybe I've got hold of the wrong end of the stick, in which case I'm open to ideas, but this conceptual model works for me presently.

Which would mean:
1. One needs to install the full driver suite and not just WDM drivers (though I'd love to hear from people for whom Windows built-in drivers alone were enough).
2. The WinDVD/ PowerDVD DirectX filters implement the functionality to present the H.264 decode as a render process to the GPU... one can therefore not bypass them. Whether one thinks of them as 'drivers', 'codecs', 'filters', or anything else is what works for you, people. They do the same job, nevertheless... personally, I'm a 'codec' man. ;-)

Cheers!
Umang
 
Back
Top