MP uses AAC audio decoder for MKVs and MP4s!

Discussion in '1.0 final and SVN Builds' started by damaster, February 11, 2009.

  1. damaster

    damaster Portal Pro

    Joined:
    November 23, 2007
    Messages:
    412
    Likes Received:
    35
    Ratings:
    +35 / 0
    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 (Text):
    1.  
    2.           if (extension.Equals(".mp4") || extension.Equals(".mkv"))
    3.           {
    4.             if (strH264VideoCodec.Length > 0)
    5.             {
    6.               h264videoCodecFilter = DirectShowUtil.AddFilterToGraph(graphBuilder, strH264VideoCodec);
    7.             }
    8.             if ([B]strAACAudioCodec[/B].Length > 0)
    9.             {
    10.               aacaudioCodecFilter = DirectShowUtil.AddFilterToGraph(graphBuilder, strAACAudioCodec);
    11.             }
    12.           }
    13.  
    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.
     
    • Like Like x 3
  2. Google AdSense Guest Advertisement



    to hide all adverts.
  3. jacc1234

    jacc1234 Portal Pro

    Joined:
    April 11, 2008
    Messages:
    167
    Likes Received:
    8
    Ratings:
    +8 / 0
    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.
     
  4. damaster

    damaster Portal Pro

    Joined:
    November 23, 2007
    Messages:
    412
    Likes Received:
    35
    Ratings:
    +35 / 0
    Home Country:
    Canada Canada
    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.
     
  5. tourettes
    • Team MediaPortal

    tourettes Retired Team Member

    Joined:
    January 7, 2005
    Messages:
    17,301
    Likes Received:
    4,595
    Ratings:
    +4,810 / 3
    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).
     
  6. revs
    • Premium Supporter

    revs MP Donator

    Joined:
    February 1, 2007
    Messages:
    1,274
    Likes Received:
    72
    Occupation:
    Software Developer
    Location:
    The Sauce of Worcester
    Ratings:
    +72 / 0
    Home Country:
    Wales Wales
    That would be very handy!
     
  7. damaster

    damaster Portal Pro

    Joined:
    November 23, 2007
    Messages:
    412
    Likes Received:
    35
    Ratings:
    +35 / 0
    Home Country:
    Canada Canada
    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...
     
  8. Owlsroost
    • Team MediaPortal

    Owlsroost Development Group

    Joined:
    October 28, 2008
    Messages:
    5,506
    Likes Received:
    2,777
    Location:
    Cambridge
    Ratings:
    +4,063 / 1
    Home Country:
    United Kingdom United Kingdom
    Show System Specs
    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
     
  9. damaster

    damaster Portal Pro

    Joined:
    November 23, 2007
    Messages:
    412
    Likes Received:
    35
    Ratings:
    +35 / 0
    Home Country:
    Canada Canada
    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.
     
  10. ronilse
    • Team MediaPortal

    ronilse Retired Team Member

    Joined:
    July 19, 2005
    Messages:
    4,422
    Likes Received:
    280
    Gender:
    Male
    Occupation:
    MediaPortal tester
    Location:
    Moss
    Ratings:
    +280 / 0
    Home Country:
    Norway Norway
    Show System Specs
    Hi,
    I'm not able to reproduce this, so which splitter do you use for mkv's (I use Matroska)?

    Regards
    Roy
     
  11. damaster

    damaster Portal Pro

    Joined:
    November 23, 2007
    Messages:
    412
    Likes Received:
    35
    Ratings:
    +35 / 0
    Home Country:
    Canada Canada
    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.
     
Loading...

Users Viewing Thread (Users: 0, Guests: 0)

  1. This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
    By continuing to use this site, you are consenting to our use of cookies.
    Dismiss Notice
  • About The Project

    The vision of the MediaPortal project is to create a free open source media centre application, which supports all advanced media centre functions, and is accessible to all Windows users.

    In reaching this goal we are working every day to make sure our software is one of the best.

             

  • Support MediaPortal!

    The team works very hard to make sure the community is running the best HTPC-software. We give away MediaPortal for free but hosting and software is not for us.

    Care to support our work with a few bucks? We'd really appreciate it!