DirectShow Filters for Windows Vista x64 and 64bit Codecs
Posted by Jarrett on 12/15/2008 6:50:00 PM - CSTA new version of GraphStudio (an open-source graphedit replacement) was released that supports x64. This is big news because previously, there was not a single filter management program on the internet that would work with 64 bit codecs. Therefore, it was near impossible to understand why a media file would not playback in the 64 bit version of Vista Media Center.
Background on 64bit and 32bit Codecs
When codecs are compiled for either 64bit or 32bit they are only compatible with media players of the same type. You cannot mix and match. This is especially a problem on Vista x64 because Vista Media Center runs as a native 64bit application. However, Windows Media Player on 64bit systems defaults to 32bit even though there is a 64bit version installed side by side (the start menu just points to 32bit version).
It's Best to Choose a Side
Therefore, if you need Vista Media Center, stick to only 64bit codecs. Do not install any 32bit codecs and instead of using the default 32bit WMP, use the 64bit version found at "C:\Program Files\Windows Media Player\wmplayer.exe" or better yet use Media Player Classic - Home Cinema x64 edition. If you want to use a 32bit or x86 media player and still utilize VMC, then you'll have to install two versions of each codec you want to use.
To make things worse, it is possible for 32 bit filters to conflict with 64 bit filters.
My (wild) guess would be that the graphbuilder is instructed by templates from 32-bit filters (either Haali or Gabest source/demux filters) to use some 32-bit source/demux instead of "File Source (Async.)" that for obvious reasons won't work - RadScorpian
His guess was confirmed.
Microsoft was stupid enough to make this keys shared between 32/64bit. This means that playback will break in many applications if you have got different source filters installed for 32/64 bit. Media Player Classic is the only DS player I know of that can cope with this issue. - clsid
This also explains why even with all the internal filters turned off, that MPC-HC x64 was still able to play video's that other 64bit players could not. Since I installed some 32bit filters first, it created a registry key pointing to the 32bit filter rather than the 64bit filter. See Troubleshooting for more information on how I fixed it.
My Setup
I like to play MKV backups I keep on the hard drive so I use the following filter's:
- MPC Video Decoder x64 ( MPCVideoDec.ax) for DXVA hardware accelerated AVC and VC1 decoding
- Matroska Splitter x64 ( MatroskaSplitter.ax) for playback of MKV and MKA files
- ffdshow x64 ( ffdshow.ax) for playback of various video types and multichannel audio such as FLAC, DTS Master Audio, AC3 Dolby True-HD
Installation
ffdshow comes with an installer. When you install ffdshow make sure you uncheck the codecs that you want the MPC Video Decoder to decode with hardware acceleration (at least H.264 / AVC and VC-1).
Note: If you've already installed you can uncheck the codecs in the property page.
To install MPCVideoDec.ax and MatroskaSplitter.ax files you'll need to do this manually. Put these files somewhere permanent and then register them using the following command lines:
> C:\Windows\SysWOW64\regsvr32.exe D:\Programs\Filters\MPCVideoDec.ax
> C:\Windows\SysWOW64\regsvr32.exe D:\Programs\Filters\MatroskaSplitter.ax
Testing Playback
To test you've installed the 64bit filters correctly, you can just try and play a file in the 64bit version of WMP. However, WMP gives you little if any indication of what went wrong if the video does not play back correctly (same with VMC).
A better method to check your codecs are installed correctly is with the afore mentioned GraphStudio x64.
Open GraphStudio and go File -> Render Media File… to open a graph of the media file. If you get a "Cannot render file" message then something went wrong and you should check Troubleshooting. If you see a graph built, then you should make sure it is using the proper filters. For example, for my MKV file I want it to use the MPC - Video Decoder for the x264 video and the ffdshow Audio Decoder for the DTS Master audio.
If the wrong filter shows up then you may need to alter the merit of the filters or toggle the type of filters that each codec will decode. To toggle merit, see Troubleshooting.
Setup VMC and WMP to See MKV File Types
You may have noticed that VMC and WMP does not recognize MKV files as video files. You will need to register the MKV file type in the registry for these Matroska files to show up. Be sure you backup your registry before proceeding. Also, this step must be done with Admin rights.
Download this file: RegisterMatroska.reg
Or copy and paste the following into a text file called "RegisterMatroska.reg"
Windows Registry Editor Version 5.00 [HKEY_CLASSES_ROOT\.mkv] "PerceivedType"="video" "Content Type"="video/x-matroska" [HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Multimedia\WMPlayer\Extensions\.mkv] "Runtime"=dword:00000007 "Permissions"=dword:0000000f "UserApprovedOwning"="yes"
Double-click the registry file to alter your registry.
For a more comprehensive registry tweak for Matroska, please see Add MKV/MKA Support to Windows Media Player 11 & Windows Media Center
Troubleshooting
"Cannot render file" - This may occur if you don't have the necessary codecs or there are conflicts with existing 32bit codecs. If you previously installed 32 bit codec you may need to delete a registry key to get the 64bit codec to work.
For example, I could not play an MKV file until I opened the registry "regedit.exe" and deleted the following key:
"HKEY_CLASSES_ROOT\Media Type\Extensions\.mkv"
Wrong Filter in Graph - This may occur if there are multiple filters that are capable of decoding the media format. This is usually a problem if you prefer one filter over the other because one may support hardware acceleration and the other does not.
Some filter's have many codecs built in and you must enable the codec from the property page. For example, the MPC - Video Decoder has a tab where you can toggle the codecs it handles. In GraphStudio, you can access a filter's property page from the Graph menu -> Insert Filter… -> Choose Filter -> Click Property Page button.
In some cases this isn't enough to get the filter to load. You may also need to alter the merits of the codecs involved. Merit values define the order in which the Filter Graph Manager tries to add filters during graph building. You can change merit values in GraphStudio.
GraphStudio is currently the only application that can manage 64bit codecs. All other codec managers only show 32bit codecs.
From GraphStudio open the filters and choose the filter you'd like to alter the merit of. For more information about setting a merit value, see Understanding DirectShow Merits.
Comments
Posted by David Hayes on 12/17/2008 5:56:12 PM - CST
Posted by Jarrett on 12/18/2008 5:32:14 PM - CST
Posted by Dhalsim on 3/3/2009 8:00:32 AM - CST
Wow, that is great advice, I have been trying to get my MKV's to run with hardware acceleration for a long time with no success. I have not tried this method though, so I will. Can you tell me where I can get the latest version of Graphstudio? I have tried searching for it but the search comes back with many versions and I would like to use the latest but cannot find an official site. Many thanks
Posted by Howie on 4/19/2009 1:50:21 PM - CST
How do you set this up to just use 1 engish sound track, when a few are present in the file?? I see your example of the graphstudio render has numerous audio streams showing that are cut off in the picture, how do you get around the player playing all of them at once, i just want the main english track to play?? TIA.
Posted by JarrettV on 5/30/2009 8:50:28 AM - CST
Posted by JarrettV on 5/30/2009 8:52:51 AM - CST