Audio tips with ffdshow and AC3Filter.

Posted by Jon | HTPC,Tips, Tricks & Guides | Wednesday 22 April 2009 2:32 pm

For the longest time, I’ve encoded most of my movies with AAC audio since I can go pretty low on the bitrate while still keeping all the original channels plus excellent audio quality compared to the source.  Recently, I stopped encoding AC3 (although, depending on the length of the movie, I will encode DTS on occasion) since the space saved is not as much of an issue as it used to be since HD media was introduced.  This has caused me to recognize many solvable issues that I have seen with various users who are disappointed when playing back titles in their encoded video library.  So, what I want to share is how to take two widely known codec packages in order to get the most (and possibly more) out of your encoded videos.

To begin, if your videos already contain the original AC3, DTS, or whatever came with your disc, then this isn’t really for you.  Enabling pass-through for the relevant audio type in ffdshow or AC3Filter will get you where we’re going (if you have a receiver capable of decoding such types).

Second, you will need a receiver capable of decoding your output stream, which for the most part, is going to be at least a 448kbps Dolby Digital AC3 audio stream.  You are going to need to download the latest release of ffdshow (I suggest the clsid releases) and AC3Filter (you’re also going to need Haali Media Splitter for any MKV/MP4 files.  These instructions are for 32-bit only, so keep that in mind.  I don’t run any HTPCs on 64-bit…just my test system.  Install both with default everything…we’ll configure shortly.  I also assume no other codecs are installed or configured to hijack these…so if you use anything else to process audio/video, your results may vary.

Now, we want to configure ffdshow audio properties, so find that in your program’s menu and start up the audio decoder configuration.  You’re going to want to let ffdshow provide a decoder for MP3 and AAC , for certain (any of the options available except “disabled” are fine).  I would also set AC3 and DTS to “disabled” here.  Everything else is up to you and outside the scope of this guide.

*Note: You can set MP3 audio to disabled in ffdshow and let AC3Filter do direct transcoding.  It’s probably best to do it that way, but it’s up to you.  This is why you disable MPEG passthrough later in the guide (so that MP3 isn’t passed as PCM stereo).

setffaudio.jpg

That’s pretty much it for the ffdshow audio decoder.  All we have done is set ffdshow to be the primary decoder for MP3 and AAC streams.  By default, ffdshow will decode these into a 16-bit integer sample that our sound processing application, AC3Filter, can use.

AC3Filter can be set up in any number of ways, but I am going to focus on one…after we’re done, you should be able to use common sense to figure out how to apply it to different speaker/output configurations.  It’s a daunting piece of software at first look, but it’s actually quite simple in its function – take x stream, apply y settings, output z stream.

Fire up AC3Filter – you will get a warning, so just click OK.  From here, we will go tab-to-tab from the top.  Under the Main tab, the first thing we want to do is decide our output format.  This will be how your audio stream goes out to your receiver.  If you have a 5.1 surround system (assumed for this guide), you will choose 3/2+SW 5.1 channels in the dropdown box.  Leave Rate and Format alone, but ensure that Use SPDIF is checked.

ac3fmain.jpg

The next three tabs (Mixer, Gains and Equalizer) you can skip.  They may come in handy for you if you need to adjust the gains for your individual speakers, but since I can’t account for your setup, I will leave those up to you (I do use them, fyi).  On the SPDIF tab, ensure that your output is still the same (3/2+SW 5.1 channels with SPDIF checked).  You will also want to take note of the SPDIF passthrough section here.  If you have a receiver capable of decoding DTS, you will want to make sure AC3 and DTS are checked.  I, personally, leave MPEG Audio unchecked, since I want all MPEG audio upconverted to surround (it’s virtual, but I still think it sounds quite good).  I’ll leave it up to you if you want to pass it or not (so long as your receiver supports it, of course).  I also set the SPDIF/DTS mode to Auto over Padded.  I don’t know why, so leave it ‘as is’ if you want.  Under SPDIF options, I set the bitrate to 448 instead of 640, but that is also up to you.  I don’t see the point in going all the way to 640 since it’s just making more of something out of nothing, but whatever.  I do suggest checking off 44KHz and 32KHz (or unchecking Restrict SPDIF sample rate altogether) so that your receiver supports additional frequencies (receiver must support them though!).  Some of my older XviD encodes do have 44KHz audio and do NOT have audio unless I enable it here.  Everything else on this tab can be at default, unless you know what you’re doing.

ac3fspdif.jpg

On the System tab, make sure everything under Use AC3Filter for is checked.  In fact, the defaults on this page are good.  I do recommend checking Show tray icon, just so you know AC3Filter is being used when playing back a file.  Other than that, you should be gold from here.

ac3fsys.jpg

We’re done!  Hit Apply and OK and your settings will be saved.  Fire up Media Center in windowed mode and go play an AVI, MKV or MP4 file that has an MP3 or AAC audio source and you should see the tray icons for ffdshow audio and AC3Filter show up (lef to right – ffdshow audio, ffdshow video, AC3Filter, Haali Media Splitter).

icons.jpg

As I said, this little guide assumes a pretty vanilla setup with a true 5.1 DD capable receiver.  Your sound card will also have to be properly setup to pass digital audio over optical or coax.  Aside from that, hope this helps some of you!

Update:

Upon finishing this, I realize that there may be some readers scratching their head wondering, “What the hell do I want to do this for?”

I understand, so let me explain a little about what we’re doing in this guide.  Say you take  a standard DVD you just bought that is on dual layer media.  The movie portion you want, after extraction, is around 7.5GB.  For some, that’s no big deal.  However, for someone like me who rips everything for convenience, the space required for 2500+ movies and 100+ TV series would be staggering.  So, I encode.

I will take a typical 2 hour movie that has, say, a 1536kbps DTS track and compress it down from the original 7.5GB to about 1.5GB.  I won’t get into any arguments about it, but quality is very close to the original (to me; and that’s what matters).  That 2GB DTS track went down to a 5.1 channel AAC track that is now only a couple hundred MB at 256kbps.  Does it sound as good as that DTS track?  No, but it sounds damn good just the same.

Since my receiver cannot decode a raw AAC track, I must transcode it into something it can decode, in realtime, while watching.  That’s where AC3Filter comes into play.  ffdshow is the decoder for the AAC track, which AC3Filter interecepts (something like GraphEdit can show you this when using Media Player Classic).  Since we have AC3Filter set to output a 448kbps 5.1 AC3 stream, that is what goes out to your receiver.  Depending on the model of your receiver, you should have your DD indicator light up and have a good surround sound output (audiophiles, go away!).

What’s even better is that the typical stereo MP3 tracks will receive spacialization during the transcode process and they will also be output at 5.1 sound.  In fact, anything that goes through this graph will be converted to a 448kbps AC3 stream, unless it’s already a stream specified for passthrough.

Later, I may show those of you who have 7.1 systems how to use the ffdshow mixer to output everything into 8-channel audio (it’s not DD, but it’s pretty freakin’ nice to my ears at home!).

  • Share/Bookmark

6 Comments »

  1. Comment by Sinjen — February 2, 2010 @ 11:10 pm
    Browser: Firefox 3.5.7 OS: Windows Vista

    FYI. This is a great post. I’ve read it several times, but read it again tonight in its entirety. It has helped remove a lot of the “black magic” feeling I’ve always gotten from AC3filter setup.

    Thanks.

    -Sinjen

    [Reply]

    Jon Reply:

    Thanks. Even though it only does audio, AC3Filter is probably my most prized codec. ffdshow would be a very close second though :)

    [Reply]

  2. Comment by kanu — April 12, 2010 @ 2:20 pm
    Browser: Internet Explorer 7.0 OS: Windows XP

    Excellent article

    [Reply]

    Jon Reply:

    Thanks! It doesn’t really apply anymore if you’ve moved on to 7MC, but Vista users should still find it helpful. I don’t even use AC3Filter anymore since moving to 7MC, so I may do a new writeup to explain how I handle it now. I’m pretty certain there are other guides available that will show how to use ffdshow and Win7DSFilterTweaker to obtain the same results, but if not, that’s what to expect sometime in the near future.

    [Reply]

  3. Comment by Sinjen — April 13, 2010 @ 9:48 pm
    Browser: Firefox 3.5.9 OS: Windows Vista

    I think a 7MC article showing how to do this would be very appropriate. Oh and I’ve read many articles on the web about AC3filter, but yours was better and more practical.

    [Reply]

    Jon Reply:

    There are a couple of guides there, but they’re a little dated. Instructions are pre-Win7DSFilterTweaker availability, so it involves manual registry hacking and probably some dll renaming to get around Media Foundation. The ffdshow settings guide is still applicable, but that doesn’t help if it doesn’t work. Tricky business side-stepping Media Foundation sometimes…

    [Reply]

RSS feed for comments on this post. TrackBack URI

Leave a comment