MP uses AAC audio decoder for MKVs and MP4s! (1 Viewer)

damaster

Portal Pro
November 23, 2007
412
35
Home Country
Canada Canada
TV-Server Version: 1.0
MediaPortal Version: 1.0 SVN 21688
MediaPortal Skin: StreamedMP
Windows Version: Windows Vista
CPU Type: AMD X2 6400+
HDD: WD SE16 500GB, Samsung SpinPoint 1TB
Memory: 2GB DDR2 800
Motherboard: Gigabyte GA-MA69GM-S2H
Video Card: ATI Radeon HD 3470
Video Card Driver: Catalyst 9.1
Sound Card AC3: Realtek HDMI Audio
1. TV Card: Hauppauge Nova-S Plus
1. TV Card Type: DVB-S
MPEG2 Video Codec: MPC - Mpeg2 decoder
MPEG2 Audio Codec: AC3Filter
h.264 Video Codec: PowerDVD 8 H.264/AVC/VC1 decoder
Satelite/CableTV Provider: Nimiq 82W, Nimiq 91W
HTPC Case: nMedia 2000B
Cooling: Scythe Mini Ninja
Power Supply: Corsair 450VX
Remote: Home Theater Master MX-700
TV: Panasonic 58" TH-58PZ800U
TV - HTPC Connection: HDMI

I recently updated to MediaPortal 1.0 and SVN 21688 and noticed that my 720p/1080p MKVs were not using the right audio decoder. I dug through the source code and discovered that for some very strange reason in VideoPlayerVMR9.cs the decoder configured for AAC audio is being used if the video file has .mkv or .mp4 extension.

This is ridiculous in my opinion and I don't understand how this got approved as a valid code change! MKV containers are not limited to AAC audio, and more often than not contain multi-channel AC3 or DTS audio. My AC3/DTS passthrough decoder of choice is AC3Filter but now I can't use it because it doesn't register as a valid AAC decoder and thus I can not select it in MediaPortal configuration!

Here is the section of code that I feel is wrong:
Code:
          if (extension.Equals(".mp4") || extension.Equals(".mkv"))
          {
            if (strH264VideoCodec.Length > 0)
            {
              h264videoCodecFilter = DirectShowUtil.AddFilterToGraph(graphBuilder, strH264VideoCodec);
            }
            if ([B]strAACAudioCodec[/B].Length > 0)
            {
              aacaudioCodecFilter = DirectShowUtil.AddFilterToGraph(graphBuilder, strAACAudioCodec);
            }
          }

UPDATE: This is clearly a bug that is causing problems for many folks and leaving them unable to play audio with their MKV files. As a result I am including a patch for the current SVN until this gets fixed in the official stream.

Attached is a patch for SVN 21688.
 

jacc1234

Portal Pro
April 11, 2008
167
7
Good catch. Is the same issue present with EVR? This is a fairly significant bug either way because the only way I can get perfect 1080p playback is by using AC3 filter for 5.1 audio.
 

damaster

Portal Pro
November 23, 2007
412
35
Home Country
Canada Canada
Good catch. Is the same issue present with EVR? This is a fairly significant bug either way because the only way I can get perfect 1080p playback is by using AC3 filter for 5.1 audio.

This issue is independent of the renderer, so yes it happens with EVR and VMR. I am using EVR.

Ideally MP should choose the right decoder by looking at what is actually within the MKV container and not based solely on the file extension. For example, if it finds that the primary audio track is AC3/DTS multi-channel then it should use the general decoder configured for audio, but if it finds AAC audio only then should it use the decode configured for AAC audio.
 

tourettes

Retired Team Member
  • Premium Supporter
  • January 7, 2005
    17,301
    4,800
    Ideally MP should choose the right decoder by looking at what is actually within the MKV container and not based solely on the file extension. For example, if it finds that the primary audio track is AC3/DTS multi-channel then it should use the general decoder configured for audio, but if it finds AAC audio only then should it use the decode configured for AAC audio.

    Most likely MP 1.0.x isn't going to get any bigger graph building related changes. What I see is that we shouldn't use any specific audio codecs for my videos playback but instead let directshow chose the correct codec based on the filter merits.

    MPII is a different case where the player framework will be re-written and one possibility would be to allow users to chose codecs on stream type basis (no locked down plans have been made yet).
     

    damaster

    Portal Pro
    November 23, 2007
    412
    35
    Home Country
    Canada Canada
    Ideally MP should choose the right decoder by looking at what is actually within the MKV container and not based solely on the file extension. For example, if it finds that the primary audio track is AC3/DTS multi-channel then it should use the general decoder configured for audio, but if it finds AAC audio only then should it use the decode configured for AAC audio.

    Most likely MP 1.0.x isn't going to get any bigger graph building related changes. What I see is that we shouldn't use any specific audio codecs for my videos playback but instead let directshow chose the correct codec based on the filter merits.

    MPII is a different case where the player framework will be re-written and one possibility would be to allow users to chose codecs on stream type basis (no locked down plans have been made yet).

    Back to the original issue: do you agree that it's a bug? MP shouldn't be using the AAC decoder for MKV and MP4 files, right? In my opinion, that's just wrong...
     

    Owlsroost

    Retired Team Member
  • Premium Supporter
  • October 28, 2008
    5,540
    5,038
    Cambridge
    Home Country
    United Kingdom United Kingdom
    Looking at the SVN change log - SourceForge.net Repository - [mediaportal] Log of /trunk/mediaportal/Core/Player/VideoPlayerVMR9.cs - looks like it was changed in response to this bug "mantis 1892: MKV videos with AAC audio may not play with sound using the internal player." on Dec 24th

    It does seem an odd thing to do for a 'universal' container format like MKV - I use MKV with MPEG-2 video and MPEG/AC3/LPCM audio so I can have files with chapter points e.g my own HDV camcorder footage.

    Tony
     

    damaster

    Portal Pro
    November 23, 2007
    412
    35
    Home Country
    Canada Canada
    Looking at the SVN change log - SourceForge.net Repository - [mediaportal] Log of /trunk/mediaportal/Core/Player/VideoPlayerVMR9.cs - looks like it was changed in response to this bug "mantis 1892: MKV videos with AAC audio may not play with sound using the internal player." on Dec 24th

    It does seem an odd thing to do for a 'universal' container format like MKV - I use MKV with MPEG-2 video and MPEG/AC3/LPCM audio so I can have files with chapter points e.g my own HDV camcorder footage.

    Tony

    Agreed about MKVs being quite a universal container in which the audio encoding is irrelevant to the actual container. This is why I feel like this change is very silly. I bet MKVs with AAC audio are a very small minority of the MKVs out there.

    Anyways, I've fixed it by patching my own install, but this bug really needs to get resolved.
     

    ronilse

    Retired Team Member
  • Premium Supporter
  • July 19, 2005
    4,422
    283
    Moss
    Home Country
    Norway Norway
    Hi,
    I'm not able to reproduce this, so which splitter do you use for mkv's (I use Matroska)?

    Regards
    Roy
     

    damaster

    Portal Pro
    November 23, 2007
    412
    35
    Home Country
    Canada Canada
    Hi,
    I'm not able to reproduce this, so which splitter do you use for mkv's (I use Matroska)?

    Regards
    Roy

    I use Matroska splitter, and here's how to reproduce:
    - In MP Configuration, under Videos -> Video Player: set AC3Filter as the "MPEG / AC3 audio decoder". Set ffdshow audio decoder as the "AAC audio decoder".
    - In MP, play an MKV with an AC3 or DTS audio track.
    - Open up GraphEdit, and connect to remote graph. You will see that instead of AC3Filter being used ffdshow will instead be used.

    It's quite clear cut in the code, but you can test it to confirm anyways.
     

    Users who are viewing this thread

    Top Bottom