andy vt's tools & blog

automating lazy

This Blog


andy vt's blog

November 2008 - Posts


    •  Added deinterlacing option, -im

    • Added http streaming option (http port#)
    bin | source
  • Understanding Merit to Optimize Playback

    I’m going to assume some familiarity with DirectShow and how it works, but if miss that mark and don’t explain something that isn’t common knowledge please let me know and I’ll dig into it further.  There is a ton of really good information about DirectShow on MSDN and other places, so I don’t want to spend too much time explaining topics that have already been covered.

    DirectShow uses graphs (where the graph in GraphEdit comes from) to control playback, applications add filters to the graph to actually render the content.  Filters do all the work in a graph; extracting data from the container (mkv, asf, dvr-ms, etc), decoding it, and rendering it.  They can do much more complex things, but in a simple playback graph that’s pretty much all there is too it.

    When an application builds the playback graph, it can explicitly add all the filters, rely completely on DirectShow’s Intelligent Connect (IC) feature, or a little of both.  Relying completely on IC isn’t very practical and often leads to undesirable results in an application, but for those applications that try to support a wide variety of media types it is an essential feature.

    When using IC, the graph orders filters by merit and tests them to see if they support the type it’s looking for before allowing it to actually join the graph.  Given this, it’s easy to see that merit is an essential part of controlling how the playback graph gets built.  And it’s also a source of frustration when, after installing a new application, suddenly everything that used to work flawlessly doesn’t.

    Simply, merit is a number.  Since the graph tests filters in order according to merit (highest to lowest), the higher the number, the more likely it is that a particular filter will join the graph.  Not all software venders are considerate to the ecosystem they are getting installed into and assign very high merit numbers to their filters (cough, ArcSoft) which then overrides the filter that used to get loaded.

    DirectShow was designed to allow applications a way to provide “hints” to IC by adding filters to the graph before using IC to build the graph.  When there are unconnected filters in the graph, it will temporarily ignore the normal merit based process and give them preference over a filter with higher merit that is not in the graph.  Adding a filter in this way doesn’t guarantee that it will get used (even if it can decode the stream); only make it much more likely.  Let’s ignore this scenario for now, because even when using it, sometimes unexpected results occur and we’ll get to how to fix those cases after a simple example.

    There are several tools for examining and modifying filter merit; I usually use GraphStudio.  GraphStudio is an open source replacement for GraphEdit.  For the most part it provides a richer, more polished experience making it a much better alternative.  To modify filter merit, the application must be running in an administrative context (right-click and select “Run as administrator” if UAC is enabled).  Then select Graph -> Insert Filter to display the Filter Browser.

    After the browser opens, you will see a list of the DirectShow filters (other categories are browsable, but beyond the scope of this topic) listed in alpha order, to the right is the filters Merit value.  The number is in hex, but don’t let that scare you select the filter that you want to modify and click the “Change merit” button.  GraphStudio provides a nice interface to change the number, along with an easy to understand explanation of the number assigned.  Some numbers won’t resolve to a defined constant, but those are usually the kind that needs to be brought into line anyway, so it’s not a problem.

    Now that we’re comfortable examining and changing Merit, let’s fix a common problem.  OOTB Vista (versions with MC) provides a MPEG and Dolby Digital decoder that supports SPDIF pass-through.  In most cases this is the filter that I want to render all audio streams of that type, before installing ArcSoft TME everything works the way I want without needing to intervene.  Unfortunately, TME’s audio decoders are installed with obscenly hight merit values so now any time IC is used their decoders join instead of the MS one.

    Before adjusting the merit, it’s worthwhile to discuss how to figure out problem cases like the one above.  Generally, you’ll just notice that something isn’t right (HWA or AC3 pass-through is broken for e.g.); but it’s not always obvious what is causing the problem.  So when something breaks, I find the easiest way to see why is to open up GraphStudio (or GraphEdit) and drop a sample file on it.  IC will render the file for playback, and the culprit should identify itself.

    Back to fixing the audio problem, open up GraphStudio (as an admin) and browse to the MS MPEG decoder.  Looking at the merit value we can see that it’s already less likely to join a graph.  Let’s give it a little bump, and then go look at the ArcSoft decoder and assign it a lower merit value.

    I don’t generally like to go too low unless a filter is particularly offensive (although in that case you could always regsvr32 /u it, but then you risk breaking the application that installed the offending filter).   As you can see, the default merit for the ArcSoft decoder is ridiculously high, choosing a more realistic value should get things back to normal.

    It’s important to note that changing a filter’s merit probably won’t have an immediate effect.  At the very least you will need to exit and re-launch it to see a difference, but in many cases it is necessary to log off before the change will register.

    Occasionally, adjust the decoder’s merit doesn’t fix the problem; and here’s where adjusting merit gets complicated.  Where there is a media type incompatibility between a filter earlier in the chain (generally the demultiplexer / splitter) and the decoder, the change really needs to be made to that filter instead.

    As an example, I have PowerDVD 7 and ArcSoft TME installed on my extender PC which uses Intel G45HD graphics.  In order to get smooth playback for H.264 and VC-1 content, I need to split between the two application's filters to get hardware acceleration (HWA) to work properly (ArcSoft’s H.264 decoder doesn’t do HWA on G45HD; and Cyberlink’s VC-1 decoder produces jerky playback, even when HWA is working, on all my PCs).  There are a couple complicating factors taking the simple approach; first ArcSoft’s video decoder is an all-in-one filter (i.e. one filter decodes H.264, MPEG-2, VC-1) so we can’t modify the filter’s merit too low or it won’t join the graph when we need it, and second the ArcSoft decoder won’t connect to the Cyberlink demulipexer or vice versa.  Getting the Cyberlink H.264 filter to always take preference was easy, set the merit to MERIT_PREFERRED and it worked every time.   Leaving the ArcSoft’s merit alone (MERIT_NORMAL) and setting the Cyberlink VC-1 decoder to MERIT_UNLIKELY did not solve the issue because Cyberlink’s demultipexer had a merit above MERIT_NORMAL, and the ArcSoft demulitplexer was marked with MERIT_UNLIKELY.  The solution in this case was to set the two demulitplexer’s merit equal (I went with MERIT_NORMAL), and setting the Cyberlink VC-1 decoder to MERIT_DO_NOT_USE.

    Getting everything right does take some trial and error, so don't get frustrated when it doesn't work the first time out (having to log off/on does make it any less frustrating :)).

  • EVRPlay -

    - Bug fixes for DVD/VIDEO_TS playback
    - Bug fixes for MediaBrowser mode
    - Open URL option
    - Add DVD Menu option to Info dialog
    - Add Close player option to Stop dialog
    - Write last run path to SOFTWARE\babgvant\EVRPlay, LastRunFrom
    - Fixed an issue if a filter that do not have a name is enumerated
    - Added DtbXmlPath setting

    bin | source

  • SageTVLauncher -

    - Option to use Sage Webserver to delay (or not) launch; launch delay must be > 0
    - Added MaxWait in seconds, used when web server option is enabled.  Set to 0 to wait forever.
    - Option to check mapped drives, and reconnect them if they are not connected (will not work when alternate credentials are used).  Launch delay must be > 0.
    - Application selector added to settings form to make it easier to setup
    - Arguments can be passed to launch exe

    Run SageTVLauncher.exe -c to configure

    bin | source

  • Why doesn't audio count when talking about HD?

    I like Netflix a lot; as a company I think they've done an excellent job of understanding the landscape for delivering media in a way that aligns with how I want to consume it at, a price point that's comfortable.  More importantly, they also really seem to listen to their customers and understand that proactively creating a positive experience keeps customers loyal.

    That said, it galls me that they are claiming "HD" for content that only has stereo audio.  Doesn't "high definition" connote a better experience in all aspects?  I've had a 5.1+ receiver far longer than a HDTV; isn't decent audio is an integral part of enjoying a movie?  Until they (and other streaming/download solutions) get audio right it's not HD, and it won't replace a real HD (or DVD) experience in my living room.


    Posted Nov 24 2008, 05:58 PM by babgvant with 3 comment(s)
    Filed under:
  • TV Pack Update

    First off, let me apologize for not doing this sooner.  At first, I was holding off because the glimmer of hope that something would be done was still there; and then because there wasn't much to say.

    The business impact statement was first submitted on September 29th, I revised it a couple times as more responses were received.  Given the length of time (and an intermediate MC update), I think it's unlikely that there will be an update.  I have received assurances that the underlying issues have been addressed in Win7, coupled with the SDK enhancements I expect that the addin will work better, faster, and more reliably with Win7 than in any previous incarnation of Media Center.

    Thank you to everyone who responded.  It was always a long shot.

  • Finishing the Job - Disabling Media Center

    Even after disabling Media Center via group policy there is still a MC process that will run periodically. I didn't realize it until my "extender" wouldn't go to sleep (MCUpdate had pegged 1 CPU).  Fortunately, it's easy to fix.  Open up the task scheduler and right-click the mcupdate task and select "disable".

  • DXVA is working!

    Good new for those who jumped on Sage 6.5.1 for the EVR.  They've got hardware acceleration working!

    Don't know when 6.5.2 is coming, but hopefully not too long from now.  Until then, here's a screen cap :)

    MPEG2-TS[H.264 16:9 1080p@24fps, AC3/640Kbps@48kHz 5.1]


    No waiting involved, the fix can be downloaded from this thread.

    Posted Nov 18 2008, 06:57 PM by babgvant with no comments
    Filed under: ,
  • SageTV 6.5.1 Beta with EVR support is available

    Not much more to say. 

    Get it here.


    While the EVR is exposed, it doesn't actually work (VMR does).  There are lots of other reasons to give it a go, I am...

    Not quite what I was hoping for, but definitely a big step in the right direction.

    UPDATE 2:

    openning an elevated cmd prompt and running regsvr32.exe STVEVRPrstr.dll from the sagetv folder (c:\programfiles\sagetv\sagetv) fixes the EVR issue.

    Posted Nov 14 2008, 06:17 PM by babgvant with no comments
    Filed under: ,
  • SageTV getting EVR support

    Good news for Vista* SageTV users, I got an email last week** letting me know that Sage should be starting a beta with EVR support (6.5.x?) this week.

    I can't wait to get the visual quality, and CPU offload that the EVR brings in an easy to use 10' interface (EVRPlay works, but its 10' interface didn't do so well my last SAF poll).  If only I could get my HD PVR working, I'd be in HD heaven.


    * It seems that XP users can also get the EVR by installing .NET 3.5; I haven't tested it, but a recent change to EVRPlay seems to indicate that it works.

    ** Reflexively, I assumed that it was something that carried an implicit NDA; occurred to me today that it might not be the case, so I asked.  Real transparency takes some getting used to :)
    Posted Nov 10 2008, 03:01 PM by babgvant with 2 comment(s)
    Filed under: ,
  • Fixing the HD PVR BSOD

    A while back when messing around with AnyDVD, I started getting a BSOD (0x0000007e) whenever the HD PVR was connected to my HTPC.  I had to send my HD PVR away for a while (it was locking up periodically), so I didn't get a chance to look into it too much.  When it came back, I plugged it in and installed the latest drivers (v1.1) on my AnyDVDless machine which was fine until the next time I rebooted.

    As it turns out, the problem wasn’t AnyDVD (sorry Slysoft), but a low level device filter that ArcSoft TME installs.  Of course the strangest thing, is that TME is bundled with the HD PVR; thank you Hauppauge.  I don’t know why this problem needed AnyDVD to manifest itself originally on my main HTPC, but I’ve since been able to reproduce it on another PC that has never had AnyDVD on it. 

    Taking a look at the Hauppauge support forums, I'm not alone so here are the steps to fixing it:

    1. Disconnect the HD PVR.  While I could boot into Vista with the device off, and turn it on afterwards without a BSOD on my HTPC, that wouldn’t work on my repro PC.  Turning it off should work,  but just to be sure I pulled the power cord.
    2. Install ImgBurn.  There are other tools to that will handle removing afc.sys, but this is the tool that was recommended to me, so it’s what I used.
    3. Run ImgBurn as an administrator.  You can look the filters that get loaded as a user, but you won’t be able to remove any.
    4. From the tools menu, select “Filter Driver Load Order…”
    5. Select “afc.sys” from the list and click “Remove Selected Filter”, then click “OK”

    6. Reboot, just to be sure.

  • EVRPlay -

    - listens for some WM_USER+234 messages at "EVRPlayApp" "EVRPlayWin"
    - added Media Browser mode
    - added DTB XML option
    - Recorded TV & My Videos buttons launch respective tabs in Media Browser
    - added PriorityClass setting

    bin | source

  • SageTVLauncher -

    - added WOL Mac: if present a WOL packet will be sent
    - added launch delay: how long to wait before launching the configured exe (useful if you need to give your Sage server time to wake up)
    - fixed a launching bug

    bin | source


  • DVRMSToolbox - Public Release

    - Fixed proppage.dll registration crashing dvrmstompegsettings on x64
    - Added MceState registration check when launching dvrmstompegsettings, should address mcestate not registering properly on x64
    - AutoZoom should apply only once per file
    - folder processor driven off of watched types
    - Prevent standby will prevent standby (instead of just asking for it)
    - Fixed a file path selection bug in the settings tool
    - Cleanup process will cleanup orphaned "Cleanup Ext" in the watched folders

    x86 | x64 | Source

@2008 andy vt
Powered by Community Server (Non-Commercial Edition), by Telligent Systems