Thursday, January 20, 2011

Windows 7 Media Center, XBOX360 Extenders and MKV container formats

The Matroska Multimedia Container format (MKV) is a free and open-standard container format which allows any number of video, audio and subtitle tracks to be stored in a single file. Some would argue that MKV is the ONLY container format to use today, and with good reason since it supports advanced H.264 video compression standards used for High-Definition video, the latest standards in multi-channel audio, and it's supported by a multitude of portable media players and installable media solutions such as XBMC, Mythbuntu, etc.

Unfortunately Windows 7 does not include native support for the MKV container format, however playback of H.264 streams and multi-channel audio in other container formats is supported, but only through the new Media Foundation framework. Media Foundation was introduced in Windows Vista already as a replacement for DirectShow - DirectShow is still supported in Windows 7, however its use is discouraged. Windows 7's Media Foundation pipeline is what brings native support for H.264 to Windows 7 and makes use of DirectX Video Acceleration (DXVA) on supported graphics cards when available, all without requiring additional codecs to be installed.

The key to playing MKV content is to install a component which allows Windows 7 to 'open' (or more accurately 'split') the MKV container format to get to the H.264 and audio streams, and there are a number of simple ways to achieve this, the most common being installing Haali's Media Splitter (http://haali.su/mkv) or installing a codec pack such as Shark007's codec solution (http://shark007.net/).

This all works perfectly when using Windows 7 Media Center in isolation, as your sole entertainment solution directly connected to your LCD/Plasma and amplifier, but these splitters and codec packs do nothing for MKV playback when including one or more XBOX360 Extenders into your solution for remote access to media from other locations around the home. Even though Microsoft included H.264 support for XBOX360's in 2007, the MKV container is not supported. Since there is no option to install a splitter on the XBOX360 to gain access to the H.264 stream, the only way to get MKV files to play on an Extender is to transcode the content to a format which is supported by the Extender before streaming, and once again there are a number or ways this can be achieved. The problem is that transcoding is intensive, reduces video and audio quality, increases load and heat output on the PC doing the encoding, and is thus not desirable to be doing on your Windows Media Center PC which is most likely tucked away in a tight spot with minimal ventilation and prone to overheating (well mine is anyway). This can be solved by offloading the transcoding onto another PC or dedicated machine, but that's not always an effective or viable solution. Wouldn't it be nice if the H.264 stream in the MKV container could be decoded natively by the XBOX360? Well it can, using the DivX Plus Codec Pack from DivX. (http://www.divx.com/en/software/divx-plus/codec-pack).

The DivX Plus Codec Pack is free, and includes a MKV splitter for DirectShow and Media Foundation. When installed on a Windows 7 machine (Haali splitter and Shark007 codecs are not required in this scenario), it allows playback of the H.264 stream in MKV containers using the Media Foundation framework from both Media Center and connected XBOX360 Extenders, without requiring any transcoding. 

The problem (and actually the point of this post) is that the splitter included in the DivX Codec Pack pack does not include decoders for AC3 and DTS audio for licensing reasons - Microsoft only allows their Media Foundation AC3 decoder to be used with their own software. Unfortunately all filters currently available, such as AC3filter, are DirectShow-based. This means that while SD and HD video from MKV containers work perfectly on both Media Center and Extenders, audio channels are limited to stereo in most circumstances which makes this solution unworkable when needing to support MKVs on Extenders.

Just to prove this theory, I did a test of my own using a clean install of Windows 7 Ultimate x86 on a PC hooked up to a 5.1 amp using SPDIF, using the following test files;
  • MKV file with AC3 audio (5.1 audio track)
  • MKV file with DTS audio (5.1 audio track)
  • MPG file with AC3 audio (5.1 audio track)
  • AVI file with AC3 audio (5.1 audio track)
This was the result:-
1. With DivX Plus installed only;
  • MKV file with AC3 - Media Player: NO AUDIO / Media Center: NO AUDIO
  • MKV file with DTS - Media Player: NO AUDIO / Media Center: NO AUDIO
  • MPG file with AC3 - Media Player: 5.1 / Media Center: 5.1
  • AVI file with AC3 - Media Player: 5.1 / Media Center: 5.1
These results seem correct and to be expected since no third-party AC3 decoder was installed for MKV files, and supported containers output audio correctly in 5.1.

2. With DivX Plus AND AC3Filter 1.63b installed;
  • MKV file with AC3 - Media Player: 5.1 / Media Center: STEREO
  • MKV file with DTS - Media Player: 5.1 / Media Center: STEREO
  • MPG file with AC3 - Media Player: 5.1 / Media Center: 5.1
  • AVI file with AC3 - Media Player: STEREO / Media Center: STEREO
That's odd - Media Player seems to use the DirectShow-based AC3Filter correctly, but Media Center will only output stereo. Oddly, a standard AVI container with AC3 audio output 5.1 correctly before AC3Filter was installed, but also dropped to stereo after installation.

So there we have it, there doesn't seem to be any way to butter your bread on both sides at the moment; either you get full 5.1 audio in Windows Media Center and transcode to your extender, or get stereo in Windows Media Center and full MKV playback support on your extender without transcoding. Think I'll take the 5.1 audio option.

5 comments:

  1. Did you enable 5.1 output in ac3filter?

    I just use haali and ac3filter. I get 5.1 output from mkvs just fine on WMP, WMC and 360MCX. The 360MCX requires DTS-->AC3 transcode though, since it can't decode DTS streams.

    ReplyDelete
  2. Using only Haali I also get perfect 5.1 from WMP or WMC (including DTS), but then you need to transcode to the XBOX. The point of this post is that if you don't want to transcode, then you're going to have endless crap like I've described.

    ReplyDelete
  3. Hi Mark... if your solution works.. i currently have 3 pcs.. a file server PC (win7)m media enter in living (win7) and a media enter in bedroom (win7) and soon a media center in theater room..

    could i just use the storage server PC as the main media center with TV cards and all that setup and then just use xboxes in all rooms as extenders .. since i wont be playing anything from the storage server .. then i would have 5.1 in all rooms from the xboxes yeah ?? only disadvantage i would have is not being able to do other PC related things .. but then it would prob save me more power and have a proper centralized TV guide and storage finally..
    is that right or am i missing something ?

    ReplyDelete
  4. by the way i am interested in dong this because of the centralized TV guide and storage more than anything... i don't mind having media centers in each room if Microsoft actually allowed release of "softsled" which allows another media center to be an extender..

    ReplyDelete
  5. I've been beating my head against this issue. I have a Media Center PC with a cable card tuner, a NAS with a ton of movies on it, and 2 XBoxes which I use as extenders.

    I've finally figured out how to get 5.1 sound out of the extenders: when I rip the DVDs that I own, I select the FFMpeg AC3 encoding option. I have AC3Filter installed on the media center machine, but I'm not convinced that's doing anything. I'm doing this as part of ripping the movies to M4Vs via Vidcoder (spent far too many hours with MKV and found there was no benefit and only pain).

    In this scenario, I get full 5.1 channel via the extender, as verified by the display on my receiver (not to mention from the way it sounds). Needless to say, I'm now re-ripping the movies that have sounds that I really care about (i.e., Dark Knight, etc). Hope this helps!

    ReplyDelete