Watching H.264 videos using DirectX Video Acceleration (DXVA)

Shortlink of this post – http://wp.me/PrgSo-2n (use this link in your forum/BBS/IRC/twitter/facebook etc. messages) || Download the PDF version of this page here.

nVidia GPU users – you may optionally read here.

Nowadays, many fansub groups released their files in h.264 format, which can be pretty taxing for older CPUs (like non-dual core ones). This will be more apparent with high definition videos like the one I reviewed here, here and here. With DXVA, you should be able to play those videos smoothly with less performance penalty upon your CPU.

This guide is the same as the one I posted at the BakaBT forum here. NOTES TO ALL USERS, PLEASE READ THE NOTES SECTION AT THE BOTTOM OF THIS PAGE.

CHANGELOG

27 December 2009 – Updated the tutorial to use MPC-HC build 1453 (notable new features are Windows 7 jump list integration, new audio renderer and some more EVR custom presenter tweaks). Most important change in this revision is the additional work on how to reconfigure the latest version of Haali Media Splitter so that you won’t get pin errors when using it in conjunction with the internal H.264 decoders.

GUIDE TO USING DXVA WITH MPC-HC

What you need to use DirectX Video Acceleration (DXVA) to accelerate those CPU-hungry h.264 video files you see a lot here:-

  1. Windows XP SP2 (SP3 recommended), Windows Vista (SP2 recommended) or Windows 7 (get the edition that has Windows Media Player 12). Windows Vista or Windows 7 are mandatory for Intel G45 users.
    My Recommendation:- Windows 7 is recommended so that you can use the new Microsoft H.264  decoder ‘Microsoft DTV-DVD Video Decoder’. So to all European readers, Windows 7 N is not the version you have to buy. For Windows XP users, consider upgrading to Vista/7.
  2. A qualifying video card that supports DXVA. A list of them are available at the bottom of this tutorial.
    My recommendation:- As of now, nVidia GeForce GT220. One of the many PureVideo4 available out there. This card here is a good one (I have one myself), which can also do bitstream decoding for VC-1, MPEG4 ASP (xVid and DiVX)  and MPEG2 videos. Also has HDMI audio, like ATI4xxx series. Plus the CUDA method at the link at the top of this page can also be used. Quite a decent card for Left 4 Dead 2 and Serious Sam First Encounter HD. There are many PureVideo4 cards (and chipsets) out there, such as the G210 and GT240 too, so off to Newegg (or your local retailer) you should go.
  3. Media Player Classic – HomeCinema. This tutorial will use the beta version build 1453. It can be downloaded from here (mirror). Change-logs for the MPC-HC can be read here or here. MediaInfo.dll now comes packaged into the archive too, so no need for a separate download. Please use 32-bit binary only even if you use 64-bit version of Windows. Make sure that you have the latest drivers too.
  4. Haali Media Splitter – Since build 718, the Matroska (.mkv) and Ogg (.ogm) internal source filters has been disabled because they are inferior to what Haali Media Spliter can do. You can still enable them of course, but from the comments you can read below, it seems that it will be better if you just let them stay disabled (.mp4 too). Download Haali Media Splitter from here or here (version 1.9.355.21). The older version (version 1.9.42.1) is available here. From the feedback at the comments (thanks a lot to Dimension), it seems that Haali is a better alternative after all). Download and install this program first before proceeding with this tutorial. Please do not disable Haali Media Splitter to use the internal source filters (they contributes to frame drops and audio de-syncing).

ATTENTION TO ATI CARD USERS, IF YOU USE WINDOWS XP, ATI CATALYST 9.4 (and above) IS THE ONLY 2009 DRIVERS YOU CAN USE. CATALYST 9.1 – 9.3 ARE NOT USABLE. VISTA/7 USERS ARE NOT AFFECTED.

FILES YOU NEED FOR TROUBLESHOOTING

DXVA CheckerDownload here (you can check whether your card is DXVA-capable and you will need this too for troubleshooting). Original website.

GPU-ZDownload here (show the detailed information about your card).

DirectX End-user Runtime – Download here. Install this if you have d3dx9.dll error message when using MPC-HC.

Microsoft .NET 3.5 Framework – Download here or here. Needed, if you don’t have it already, to use for EVR/EVR custom presenter. Also needed to run DXVA Checker.

TEST VIDEO FILES.
If you have problems enabling DXVA, please test your setup with this three videos first. If the problem is repeatable, make screenshots of your DXVA Checker and GPU-Z results and make a comment in the comment section.

test video file 1 – The Melancholy of Haruhi Suzumiya ED theme SD video with karaoke soft-sub  – here (mirror*).

test video file 2 – Elfen Lied ED theme 720p with karaoke soft-sub - here (mirror*).

test video file 3 – Kanon OP theme 1080p with no subtitles –  here (mirror*).

*= may give 404 errors sometimes, so use the first link first.


TUTORIAL

Step 1.
Download and install the MPC-HC from the link above. Unzip it where you wanted. If you have an existing MPC-HC installation (if you have CCCP or K-Lite Mega Pack), overwrite it with this copy. Also download the MediaInfo dll file, and extract the ‘MediaInfo.dll’ file in the same directory. After that, start the program.


In the example above, I deleted the MPC-HC executables that comes with CCCP (mplayerc.exe) and put with it the new MPC-HC version (mpc-hc.exe) in its place. Just so you know, for the latest version (build 1448), the executable has been renamed to mpc-hc.exe.

Download the latest version of Haali Media Splitter from the link provided above. During the setup process, when you arrived at the stage depicted below, unselect the option ‘Associate .mkv and .mka files with Windows Media Player’ before proceeding with the setup process.

If you somewhat skipped the process above, go to Start Menu —> All Programs —> Haali Media Splitter —> Media Splitter Settings (Windows 7 default start path, YMMV), and set the option ‘Use custom media type for H.264′ to ‘No’, as shown below.

Step 2.
Press O (or go to View —> Options) to open the Options window, that should look like below.

Step 3.
Go to Playback section, and make sure that Autoload Subtitles is checked. This will automatically disable DirectVobSub (auto-loading version), so no need to kill it in step 6. If you do not need subtitles, also enable this option so that DirectVobSub/vsfilter is blocked.

Step 4.
Go to Output section, and depending on your operating system, select the appropriate output you have to use. For Windows XP users, you can choose VMR7/9 renderless (if you need subtitles) plus overlay mixer and VM7/9 windowed (if you do not need subtitles – such as playing anime in AVI format that has hard subtitles, for example Dattebayo releases) while for Windows Vista/7 users, choose EVR custom presenter regardless of your subtitles needs. Keep EVR buffers as low as possible (3). If you choose renderers that did not support subtitles, DirectVobSub (auto-loading version) must be blocked in Step 6.

As I now use Windows 7, further steps will show that I am using EVR Custom Presenter.

Step 5.
Go to Internal Filters section and under Source Filters, make sure Matroska and Ogg is not selected. I also recommend that MP4/MOV is disabled too. Then go to Transform Filter, and ensure that H264/AVC (DXVA) and H264/AVC (FFmpeg) are selected.

We are now going to Step 6, which is the most important step in this tutorial. This step is very important at ensuring that hardware acceleration will work at all.

Step 6.
Here, we go to the External Filters section, because we have to eliminate intermediaries between the MPC internal decoder and the renderer. It should look like below.

Now ask yourself whether you have installed programs like ffdshow in your computer. If you have installed codec packs such as K-Lite Codec Pack or CCCP, then you may have ffdshow. In that case, click Add Filter and you will see a dialog window like below.

Select ffdshow Video Decoder and click OK, then you will see the previous windows populated with ‘ffdshow Video Decoder’ entry selected before.

Here, click Block to prevent ffdshow Video Decoder from being loaded by MPC-HC.

Repeat it with entries that you think will prevent the MPC-HC internal decoder from being connected straight to the renderer (either VMR9 renderless or EVR custom presenter). ffdshow video decoder and DirectVobSub (auto-loading version) are the main culprits that will do so. There could be others that I do not know. If you have done Step 3, DirectVobSub is killed automatically and you do not have to do so here, but if you choose to use video renderers that did not support subtitles like Overlay Mixer or VMR7 windowed, you have to block it here too. If you have other H.264 decoders installed in your computer, such as the CoreAVC Video Decoder, Cyberlink H.264/AVC decoder and Arcsoft Video Decoder, you should also block them here so that MPC-HC will not load them.

Step 7.
Go to Subtitles section, and set ‘Allow animation when buffering‘ is ticked (for those who has low-powered CPU like Intel Atom, untick this option). As long as that option is enabled, the option ‘Sub pictures to buffer’ is not exactly important (set it to 10 if you have 512MB RAM – lower if you have less), but if this option is set to zero, subtitle animation will always be enabled (therefore to disable subtitles animation, the buffer must not be zero and ‘Allow animation when buffering’ is disabled). This will allow those anime OP/ED/insert themes that has soft karaoke effects to be displayed correctly. The appropriate renderer must also be selected in Step 4 above. With the latest MPC-HC, frame drops can be reduced to almost zero even if karaoke effects are turned on.

For ‘Maximum Texture Resolution‘ option, set it to ‘Desktop’ with ‘Round up to power of two‘ unchecked. This should give you very sharp-looking subtitles but remember, the higher the resolution is, the higher the CPU resources will be used. You can lower this setting to reduce CPU utilization. See the demonstration here to see how a complex karaoke effect takes two times the CPU resources that is needed to to decode a high-bitrate 1080p video with multichannel lossless audio.

Then go to the Subtitles/Default Style section, and full tick the option ‘Position subtitles relative to the video frame’ just like the screenshot below.

This step did not apply if you do not watch videos that do not have soft subtitles.

And that’s about all you should do in the Options window.  Click Apply to apply all changes you have made, and then click OK to close the Options window.

Step 8.
Right-click within MPC-HC video area, go to Renderer Settings —> GPU Control and make sure that all three options within it (Flush GPU before VSync, Flush GPU after Present and Wait for flushes), just like the screenshot below.

If you use Windows XP or use Windows Vista/7 with Aero disabled, right-click within MPC-HC video area, go to Renderer Settings —> VSync and tick any of the options there to prevent tearing. Alternative VSync is recommended for ATI GPU users, the Accurate VSync is for everyone while VSync is similar to the ‘Lock Back-buffer option in the previous stable MPC-HC build (build 908).

I use Windows 7 with Aero enabled, thus those three Vsync settings above doesn’t apply to me.

If you use Windows Vista/7 with Aero enabled, go to Renderer Settings —>Presentation and ensure that the option Disable Desktop Composition is not ticked. If it somehow was ticked, untick it. If you are masochist enough to enable it, you have to select one of the VSync methods above or else you will get tearing. This option is useless in Windows XP (and you have to select a VSync method above).

Enable Frame Time Correction option should always be checked.

10-bit RGB option is optional. Disable if you want to take screenshots of the video being played. D3D Fullscreen Mode been made obsolete by the three VSync options above (and by Aero in Windows Vista/7), but if you use Windows XP and the VSync options and GPU Flushes cannot stop tearing when playing videos, this method is still the most foolproof way to stop tearing. If you have to resort to this, the option D3D Fullscreen GUI Support allows you to use context menu to operate MPC-HC without having to exit the application.

Again, right click within MPC-HC video area, go to Renderer Settings —> Output Range and select between 0 – 255 or 16 – 235, depending on what B&W level your display device is calibrated to. Read your display device manual for more information. Usually, computer monitors (LCD or CRT) are calibrated to 0-255 level, and TV is usually set to 16-235. But many high definition TVs nowadays are calibrated to 0-255, and some of them can have both, depending on what HDMI socket being used! Read the manual for more information.

Step 9 (for Intel G45 GPU chipset users):-

Close MPC-HC. For users who are using this Intel GPU, open up your registry editor (regedit) with administrative privileges, and add-up the modification below:-

HKEY_CURRENT_USER\Software\Gabest\Filters\MPC Video Decoder
 - Key name : CompatibilityMode
 - type : DWORD
 - value : 16 (Hex value)

A *.reg file based on the above information is available here (thanks to :D DDDD). Unzip and double-click the *.reg file inside. You may need to provide UAC account info if asked.

This will allow G45 owners to play H.264 videos that do not conform to DXVA standards. It will not be always successful, but I estimate that at least 90% of those out-of-spec H.264 videos should be playable with G45 GPU + the registry modification above. The Quantum of Solace trailer, AIR OP theme and Planet Earth sample should work though, at least with my own tests with an Acer laptop with G45 GPU + Windows Vista OS.

Warning: messing with your registry can cause your system to be unbootable. This step is always optional. Back-up your registry before attempting this modification. Make a system restore point too just to be safe.


DXVA IN ACTION

System:- Windows 7 Ultimate + Phenom X4 9500 + 4GB RAM + nVidia 9800GT G92 512MB + nVidia Forceware 186.18

The Haruhi ending – available here (SD video)

Elfen Lied ending 720p – available here (HD video in 720p)

Kanon OP 1080p video – download from  here (HD in 1080p).

WHY YOU SHOULD BUY NVIDIA GPUS & UPGRADE TO WINDOWS VISTA/7.

James Bond: Quantum of Solace trailer (mirror*) – For selected nVidia cards only with 178.24 or later drivers. The reason why you should consider nVidia cards. This video will not play in DXVA mode with ATI cards. Or either Intel G45, at least officially. To play this video with G45, the registry modification in Step 9 above has to be performed.

The ultimate video test 1 – AIR OP theme: Lia – Tori no Uta (mirror*). If your machine set-up can play this flawlessly, no videos (at least DXVA-compatible ones as detailed in the Notes section below) will faze your computer. This video will not play in DXVA mode with ATI cards. Or either Intel G45, at least officially. To play this video with G45, the registry modification in Step 9 above has to be performed.


The big chunk of the CPU usage has to do with the karaoke effect, playing the video itself takes less than 10% CPU.

The ultimate video test 2 – BBC Planet Earth: From Pole to Pole sample (mirror*). Contains the infamous waterfall and birds flyby scenes. Playable only with nVidia GPUs, and only with Windows Vista/7. Windows XP users with correct nVidia cards can only play this video using CoreAVC CUDA 2.0. This video will not play in DXVA mode with ATI cards. Or either Intel G45, at least officially. To play this video with G45, the registry modification in Step 9 above has to be performed.

*= may give 404 errors sometimes, so use the first link first.

NOTES

- I previously recommended ATI cards over nVidia, but now things has changed. First,with the release of Detonator 178.24, all qualifying cards (at least that the ones this driver supports) now officially support L5.1 videos. Second, since Catalyst 8.6, ATI has changed the way DXVA works on their cards which caused problems like macroblocking, green screens etc. and this problem will be more apparent if you use AGP cards (that’s why most users that has problems in the comment section and the boxtorrent thread usually has AGP cards). PCI-E users is also affected by this problem, but much less so than AGP users.For this, all nVidia card users should upgrade to 178.24 or later (this is the latest non-beta as of writing), grab the beta build 867 or newer and enjoy increased compatibility. For ATI users, those who has the AGP cards (HD 2xxxx and HD 3xxxx) and has problems playing videos in DXVA mode, downgrade to Catalyst 8.5 hotfix (available at http://www.ngohq.com/home.php?page=Files&go=cat&dwn_cat_id=18 or any other similar sites). If you do not have problems, do not change anything (I even suggest that you do not change your drivers ever again). If the problem persisted, you may have to use external decoders such as the one included in PowerDVD. The changes made in Catalyst 8.6 caused MPC-HC internal DXVA decoder to not work correctly with ATI cards.

- Not all videos can be accelerated. It has to be encoded with compatible profiles. The highest profile that can be used is L4.1. More info about this can be found at http://forum.doom9.org/showpost.php?p=1078122&postcount=1 and http://www.avsforum.com/avs-vb/showpost.php?p=12728994&postcount=1. With nVidia new drivers, the cards now support L5.1 profiles though. This test video is an example where MPC-HC will now decode L5.x videos which it will not before.

- Cards that supports DXVA:-

ATI:-
Radeon™ HD 3800 Series, Radeon™ HD 3600 Series, Radeon™ HD 3400 Series, Radeon™ HD 2600 Series, Radeon™ HD 2400 Series, Mobility Radeon™ HD 3600 Series, Mobility Radeon™ HD 3400 Series, Mobility Radeon™ HD 2600 Series, Mobility Radeon™ HD 2400 Series, Mobility Radeon™ HD 2300 Series, Radeon 780G integrated chipset – UVD 2 + AVP 2 (with Phenom only), Radeon HD 4xxx HD Series – UVD 2 + AVP 2, Radeon HD 5xxx HD series.


Source: http://en.wikipedia.org/wiki/Unified_Video_Decoder

nVidia:-
All GeForce 8xxx cards and IGPs except GeForce 8800GTS/GTX with G80 core.  All GeForce 9xxx cards and IGPs.  All GeForce 2xx cards.


Source: http://en.wikipedia.org/wiki/NVIDIA_PureVideo – any of the VP2, VP3, VP4 and VP5 GPU can be used. When buying, make sure it has at least 256MB of video RAM (512MB if you use Windows XP).

Intel:-
Intel G45 IGP: Windows Vista & 7 only (the latest drivers seems to be problem-free). The Step 9 above is necessary so that it can play out-of-DXVA-spec H.264 videos.

My recommendation:-

nVidia >>>>>>>>Intel G45 >>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>> ATI.

Card recommended (personally tested):-
GIGABYTE GV-N220OC-1GI GeForce GT 220 1GB 128-bit DDR3 PCI Express 2.0 x16 HDCP Ready Video Card – Can accelerate H.264, VC-1, MPEG4-ASP (DiVX and XViD) and MPEG2 videos on hardware. Also support HDMI audio (multichannel LPCM) just like ATI 4xxx series.

A good website that has an excellent comparison table can be found here. Intel G45 IGP is now supported by MPC-HC internal DXVA decoder (currently only H.264), which means you do not need to use external decoders like PowerDVD 8 with MPC-HC if you want DXVA anymore.
– I do not recommend using the 64-bit version of MPC-HC, until Haali released the long-awaited 64-bit version of Haali Media Splitter.

Known issues with DXVA enabled:-

- Seeking (fast-forward or rewind) when DXVA is enabled will not be as smooth as playback with no hardware acceleration.

- The dropped frames with soft-subtitles has largely been fixed with the latest final build, but you will still see some of it during seeking operations.

TROUBLESHOOTING

There are 3 test files available for you to download so that you can test whether you managed to use DXVA on your computer or not. If you can’t, there are few things you should check:-

Run DXVA Checker (download here) and see if your card drivers exposed their DXVA capabilities.


DXVA Checker result for AMD ATI HD5770


DXVA Checker result for nVidia GeForce GT220

Under your card name, the ModeH264_VLD_NoFGT should exist and will confirm that your card and your drivers will be able to use DXVA. If you see empty space under your card’s name instead like below:-

You won’t be able to use DXVA in MPC-HC, even if your card supports it. Try reinstalling drivers and then rerun DXVA Checker again to see whether it has been fixed. If it isn’t fixed, you may have to reformat your computer and reinstall Windows.

When posting a comment for help, please state:-

- Your operating system, inclusive whether it is 32-bit or 64-bit.
– Exhaustive information about your card. Information needed are GPU model (e.g. ATI 3450 or nVidia 9600GT), driver version (e.g. ATI Catalyst 8.12 or nVidia Detonator 178.24 – plus whether you use manufacturer drivers or ATI/nVidia drivers), video memory (e.g. 256MB, 512MB; 256MB is the minimum requirement) and most importantly, the interface (e.g. AGP or PCI-E; PCI cards do not work). If you have AGP cards (ATI only, because nVidia DXVA cards has no AGP versions), you also have to state the manufacturer of your motherboard chipset (e.g. Intel, AMD, ViA and nVidia) and whether you use the DVI-HDMI dongle. Read here to see why I want those AGP information. To make things easier, just post your GPU-Z result screenshot.
– The version of MPC-HC used.Please also make sure that your problem can be repeated with any of the three test files (Haruhi Suzumiya, Elfen Lied and Utawarerumono – not the Quantum of Solace trailer or  the AIR OP theme either).

Click the ‘Older Comments’ link to see, well, older comments for this blog post.

  • Share/Bookmark

1,391 Comments

  1. Stanley says:

    I’m watching Transformers 2 Blu-ray on my laptop, 15.4′ 1366*768, T4200 2G RAM, nForce 130M, Windows XP SP2.
    Can you tell me how I can tweak my MPC-HC to get the same experience as a HDTV?
    Does what type of renderer I use tell a difference? I’m pretty sure 130M supports DXVA and is enabled.
    The frame rate shows 24. Is this what it’s supposed to be?
    The movies runs just fine. But I think the picture quality could be better.

  2. hd4770 says:

    can DXVA use vsfilter instead of the mpc-hc one?

  3. DirectX says:

    http://www.microsoft.com/downloads/details.aspx?displaylang=en&FamilyID=0cef8180-e94a-4f56-b157-5ab8109cb4f5

    DirectX Redist End-User Runtimes February 2010 released. Ranpha, please update the DirectX Redist link to point to this one.

  4. [...] RAM ca sa am macar 1Gb. Credeti ca e suficient? despre partea de decodare citesti aici: Watching h.264 videos using DirectX Video Acceleration (DXVA). placa mai ieftina si mai buna pentru filme e asta: MSI GeForce 210 512MB DDR2 64-bit Placa video – [...]

  5. Jen87 says:

    Can the ATI HD5000 cards accelerate ALL the videos here?

  6. Thackoon says:

    I noticed that Haali Media Splitter added a 64-bit version. Anyone try this with MPC-HC x64?

  7. Bill says:

    I have a x1950 pro agp. How can i get the special function for high def playback to work????

Leave a Reply

Spam Protection by WP-SpamFree