AntiPack – Get your videos working without destroying your PC

We welcome this post from guest blogger Andrew Van Til. Also known as Babgvant, Andy has been a longtime contributor in the HTPC space and is an expert on file codecs, formats and such. He’s also the creator of the world famous DVRMSToolbox application which removes your commercials from your recorded TV programs.

I’m no fan of codec packs, more
often than not they end up causing much more harm than good.  Solving
the short term problem (how do I get this file to play) , but leaving
behind a larger mess that often leads to the conclusion that there is
something fundamentally broken with the PC as a A/V device.

The
real problem with PCs (and not just in this case) is complexity; most
(understandably) want the convenience and not the hassle of dealing
with containers and codecs so they turn to a pack to solve the
immediate need.  I completely understand that it’s a complex topic;
something that everyone that has ever tried to get mystery file X to
play has struggled with.  Doing it the right way is hard, where codec
packs are easy. After repeating “uninstall the codec pack” more times
than I care to remember, I figured it was time to do something
proactively to hopefully reduce the pain.  So it is with some
hesitation (and irony) that I’ve decided to roll my own “codec pack”. 

AntiPack
is intended to be part guide and part installer; hopefully making it
easy enough for everyone to understand what they are doing, and provide
an excellent/easy end user experience at the same time.  Most important
it is based on the filters I use on my system.  Most are almost
completly stock (with some changes to merit to reduce the arms-race
nature of many OSS filters) but some I have customized to fix issues or
to make them play nice with other filters. 

All of the filters
in the installer are OSS filters (all but one are GPL); each is
disclosed with the option to opt-out during the install and includes a
short description of what it does.  I’ve also written a simple
application that makes it easy to configure the filter where applicable
and control its merit if necessary.

Essential Downloads:

Optional Downloads

Getting Started:

If
you’re staring from a pristene install you can skip this part, but
chances are you’ve already installed another pack or ffdshow so the
first step is to get rid of them.  Hopefully whatever codec pack you
have uninstaller works and cleans out the nasty, if not GraphStudio
will help when the time comes.  

Before moving on, let’s talk
briefly about why I don’t like ffdshow.  Generally, I have found
ffdshow’s audio decoder to OK as long as you always decode to PCM.  It
can be configured to bitstream AC-3 and DTS, but will not do so
reliably.  Given the way I use audio decoders, that isn’t an issue for
me, but it is troubling that it doesn’t respect it’s own settings. 
That said the audio decoder is pretty decent, and will decode almost
anything so it can be a good solution.  The problem is that you can’t
install the audio decoder without also getting the video decoder.  With
no hardware acceleration and improperly formed media types make for a
buggy and craptacular experience.  The only reason I can think of to
use it is if you really,really want subtitles in WMP; and even then
something like VSFilter is probably a better choice.

Most
importantly, ffdshow is not a good DirectShow citizen.  It installs
itself with a ridiculously high merit, and in the default configuration
will accept almost anything so it ends up doing the same thing that
many codec packs do, screwing up your PC.  Usually just breaking
hardware acceleration, but because ffdshow also has some stability
issues (esp when it is not the only filter) it can also cause the
player to crash or exhibit strange behaviors.  If you know what you’re
doing ffdshow can have a place on your machine, but I wouldn’t
recommend it.

Installing AntiPack:

Now it’s time to install AntiPack.  

Nothing to see here, just click "Next"

Antipack

All
of the filters except one (SubtitleRender, which uses my MS-RL variant)
are GPL, so it’s easy to agree with the EULA and click Next.

Antipack

Now
it’s time to chose from the list of recommended filters.  If you’re not
running SageTV, there isn’t much benefit to installing SubtitleRender. 
If installed, it will join playback graphs outside of Sage, so if your
player supports SRT subtitles you may want to uncheck it.

Most
of the decoding work is handled by the modified MPC-HC filters.  They
include some bug fixes and changes to make them play better in my
environment.  For e.g. I prefer AC3Filter for AC-3 and DTS, but
AC3Filter does not handle LPCM (even though it claims to) properly or
decode other audio codecs like FLAC and AAC that I use.  While it is
possible to use merit to prefer AC3Filter, the outcome is much more
certain if the MPC-HC Audio Decoder won’t accept AC-3 or DTS by default.

Click Next when you’re ready.

Antipack

If
you don’t have a commercial dvd player installed (i.e. PowerDVD) and
are installing on XP or a version of Vista that doesn’t include a DVD
capable MPEG2 decoder, you should select these.  Everyone else, it’s up
to you.

Click Next when ready.

Antipack

Select
the file source/splitter filters that you’d like to install on this
page. Checking the first two (mp3/mp4) will install and register the
filters as both source and splitter.  The FLAC filter is a file source
only, and the MPEG is a just a splitter.

When a DirectShow
player loads a file it tries to find a file format specific filter
first by searching HKEY_CLASSES_ROOT\Media Type\Extensions if a
matching key is found (i.e.HKEY_CLASSES_ROOT\Media
Type\Extensions\.mp3) it looks at the "Source Filter" value for what
filter should be used.  If the key or value is missing generally it
will use the generic file source filter and search for a splitter
filter.  Registering as a source filter will guarantee that the filter
will be used if the player loads the file using this method, but since
some players will not expect the behavior it can cause trouble in some
cases.  In my experience it’s only been a problem for MPEG file types,
but your mileage may vary.

Click Next when ready.

Antipack

Choose a location and click next. After the installer completes it will automatically launch the settings tool.

Antipack

The
first tab configures the main video decoder.  Use this page to select
which video formats should be supported.  To make it easier, the page
tells you what video card is installed and each check box has a tool
tip explaining a recommended setting, some basic information about the
codec and a link to learn more.  For the lazy, there’s a button to
apply my recommended settings based on your video card.

One
thing to note; if you have a commercial media player that provides
H.264 (AVC) decoding (like PDVD or TMT) and you would prefer to use
their filter, the H.264 DXVA options should not be checked.  The MPC-HC
video decoder has been modifed to not connect to the SageTV MPEG
splitter, I was unable to make it work so the media type was removed. 
Generally this should not be an issue, since the HD PVR (the only
source I know of for H.264 in .ts files for SageTV) comes with TMT. 
Both Haali and the MPC-HC MPEG splitter present H.264 using the AVC1
mediatype which works great.

Antipack

The
next tab configures the MPC-HC Audio Decoder.  Unless "Decode AC-3 and
DTS" is checked the filter will not work for those media types.  If you
would like it to support those types check the box and set your speaker
configuration.

Antipack

Duplication
the AC3Filter configuration pages was a more complex than I was willing
to do, so clicking the big "Launch…" button will open its
configuration page and you can choose the settings that make sense for
your system.  My setup is captured below.

PCM output:

Antipack

The
main changes I make on the first tab are ensuring/setting "AS IS" and
"PCM 32bit" in the output section. I use Reclock so, SPDIF is left
unselected.  If you prefer SPDIF (bitstreaming AC-3/DTS as AC-3 or DTS
instead of decoding to multichannel PCM) make sure to check the "Use
SPDIF" option (see the Bitstream Output section below).  

Bitstream Output:

Antipack

Note the "Use SPDIF" option is checked.

Antipack

On the SPDIF tab, check both AC3 and DTS

Both:

Antipack

The
last thing to do is make sure that the types AC3Filter accepts are set
correctly.  Most of the problems I’ve seen with AC3Filter are because
PCM is checked, it also doesn’t handle LPCM correctly so you should
uncheck both.  AC3Filter treats merit like an On/Off switch; it’s
either crazy high or uselessly low.  Don’t worry about making the right
choice, the AntiPack settings tool will enforce the merit you choose on
the AC3Filter tab.

Antipack

The
last page is where the merit for each of the other filters is managed. 
Filters that are not installed will display a "NotInstalled" merit;
changing this to another value will not do anything.  Click Save to
apply all of the setting changes.  Merit is a machine level setting so
the tool will require elevation, but decoder settings are stored at the
user level.  If you have multiple user accounts on the PC they will
need to be made for each one.

Antipack

If you ever need to change the settings (or make them for another account), a shortcut is added to the start menu.

Installing Haali:

The
next step is to install the Haali Matroska splitter to enable MKV
playback.  If you don’t need to play MKV (if this is you, we need to
talk; you’re missing out ) you can skip this step.

Antipack MKV

After you’ve read the EULA, assuming you’re OK with it let’s move to the next step.

Antipack MKV

Where you choose a location for the filter and supporting files.

Antipack MKV

And the name on the start menu.

Antipack MKV

Before
Installing, it’s very important to change the defaults so Haali doesn’t
cause problems.  By default, the splitter installs not just as the
source filter (the thing we just talked about) for MKV, but also wants
to act as the source for MPEG-TS (*.ts, *.m2ts) and MPEG-PS (*.mpeg,
*.mpg) files.  IMO Haali is the best MKV splitter, but only does so-so
with MPEG; so make sure you uncheck those boxes.  I don’t use it to
split MP4 files (I use the MPC splitter included in AnitPack), so I
can’t say how well it does with those.

Antipack MKV

Alright, finally done with installing the filters.  Now let’s make sure that everything is working the way we want.

Using MediaInfo:

Don’t
worry we’re almost done 🙂  MediaInfo is the easiest way I’ve found to
tell me what codec a file uses.  Open the GUI and drag a file in.

Antipack MediaInfo

Using GraphStudio:

DirectShow
uses something called a Graph to handle playback.  It’s essentially a
container for filters (the things we just installed) that provides the
necssary plumbing so they can connect to each other and pass data in a
meaningful way.

Antipack

Just
like MediaInfo you can drag a file in, but in this case we can see how
DirectShow will create the playback graph using Intelligent Connect. 
If everything went OK (getting rid of the bad filters, and installing
the good ones) you’re done.  If it didn’t then you’ll want to read this.