Hacking Windows 7 Media Center

Converting MKV Audio Streams using MeGUI and MKVToolnix

by Michael Healy @ 11:25 am on November 9th, 2009 in converting files, encoding with 11 Comments and Permalink

Extract Audio Stream Converting audio streams already contained inside an MKV can be a daunting process for the beginner. First, we’ll need to extract the audio tracks from the MKV container then we’ll begin the process of converting the track. Finally, we’ll re-mux the entire project back into a new MKV file. There are any number of reasons why one would want to convert from one audio type to another, compatibility with certain hardware such as Media Center Extenders not being the least of them. For this guide we’ll convert from an incompatible DTS stream to an AC3 stream for Media Center Extender compatibility.

Before we get started we’ll need to download and install a few programs. First, in order to read and thereby convert the DTS stream we need a decoder such as FFDShow installed. Under a default installation FFDShow should be all set to decode a wide variety of audio formats including DTS. Next, we need to download and install MKVToolnix and MKVExtract. Installing MKVToolnix  is fairly straight-forward though in order to install MKVExtract the archive should be extracted to the same directory as you installed MKVToolnix.

Now that we have the tools to work with MKV files we also need to be able to convert the audio stream once we’ve extracted it. For that we need to download and install both AVISynth and MeGUI. These programs will allow us to work with the individual streams once they’ve been extracted from the MKV file.

Alright, time to get started. First let’s open up MKVExtractGUI from the location where we extracted it which should be in the same directory as MKVToolnix. Using this program is fairly simple, first select the MKV file we’ll be working with from the Input selection box. Once you’ve selected a file the Content box should be populated with the various tracks available. Check the box next to the audio track we want to convert and press the extract button.

mkvextract

After a few minutes (or several depending on the bitrate) you should receive a message stating that the de-muxing was successful and you should now have a .dts file in the same directory as your original MKV file.

Now that we’ve got our DTS stream extracted let’s open up MeGUI and perform the conversion. The first thing you’ll need to do with MeGUI is make sure to update the files for the conversion we’ll be doing, in most cases it can’t hurt to actually update all the available files. First time users will be prompted to update upon launching the program, others can update through the Options –> Update menu.

Next under the Audio tab , in the Audio Input box locate and select our new DTS stream file. Under the Encoder Settings dropbox you’ll need to select the correct audio format you’d like to convert to, in this case FFmpeg AC-3. FFmpeg is actually the program that is being utilized to do the conversion and you should be sure that it has been updated to the latest version through the MeGUI update process. AC-3 is the format we’ll be converting to.

megui

Using MeGUI you can also adjust many of the available settings for the conversion of the stream such as the bitrate and channels available in the newly created stream. Simply press the Config button next to the selected Encoder settings option to bring up the options dialog for that encoder. Enabling the Force Decoding via DirectShow option will enable the use of FFDShow to decode the DTS stream, if you encounter errors during encoding you may want to enable this option as well.

megui config

Once you’ve set the options and are ready to do the actual conversion return to the main MeGUI dialog window and press the Enqueue button under the audio section. Then select the Queue tab from the top of the window and press the Start button. This process will take some time to complete and there is a preprocessing period that can take several minutes before the actual process will begin. Once the process has begun you can monitor the progress through the status window.

megui status

Once MeGUI has finished converting your DTS stream into an AC3 stream we need to reconstruct our MKV file. Open MKVMerge from the MKVToolnix programs menu and begin by adding the original MKV file to the Input files. Next locate our new AC3 stream and add it to the list of input files as well. Under tracks, chapters and tags you should now see the AC3 audio source listed as well as the original DTS source. MKV supports multiple audio tracks and if your hardware and decoding software does as well you may want to leave both tracks and remux the MKV file like this. However, if you’d like to remove the original DTS track you’ll need to uncheck the track from the list before remuxing the file.

mkvmerge

Also, you’ll likely want to rename the new MKV file to something different than the original to be able to discern between the two versions. Once you’ve done that you can now start the muxing process by pressing the Start muxing button at the bottom of the window. A dialog will appear showing you the progress of the process and remuxing should only take a few minutes at most. That’s all there is to it, you should now have an MKV file with a converted audio track.

This process can also be used to convert other audio formats as well using the available MeGUI encoder settings. This guide was written with assistance from an AfterDawn guide published here.

11 Comments


Tester
Comment #4665 from Tester [Reply]

Can this guide be used to change the volume of this type of video file ?

Comment left November 9, 2009 at 12:11 pm with Permalink

Tester
Comment #4668 from Tester [Reply]

Excellent, I look forward to it.
Keep up the great work and thx

Comment left November 9, 2009 at 1:24 pm with Permalink

Andy
Comment #4669 from Andy [Reply]

There’s no need for MKVExtract, as MeGUI can also handle DirectShow playable files. This means, if you have a MKV splitter and a corresponding DirectShow filter installed, MeGUI can convert it (video and audio).

Comment left November 9, 2009 at 1:49 pm with Permalink

lithium630
Comment #4678 from lithium630 [Reply]

Ben Drawbaugh made a Dvrmstoolbox profile that does the same thing. Once set up it is much easier.

Comment left November 9, 2009 at 6:08 pm with Permalink

Anonymous
Comment #4679 from Anonymous [Reply]

I use a program that does this all in one step – Popcorn Audio Converter @ http://www.networkedmediatank.com/showthread.php?tid=20887

Simply select input mkv with DTS, choose AC3 bitrate to convert to, whether to keep DTS track in the mux and an output file. Does it all automagically and plays perfectly on Xbox 360 using Divx Preview for Win7 with AC3 5.1

Comment left November 9, 2009 at 6:33 pm with Permalink
@Reply #4694 from DamianP [Reply]

I agree, why go through all these steps when Poporn Audio Converter handles converting DTS to AC3 in an MKV all in one step. I have been using the program with no problems for some time now.

Comment left November 10, 2009 at 6:43 am with Permalink
Comment #4702 from Ray9279 [Reply]

I would have to agree with DamianP & the Anonymous poster above him that said to use the Popcorn Audio Converter. I’ve used it for several MKV files in the past and it’s worked perfectly and is so easy on top of that!

Comment left November 10, 2009 at 1:25 pm with Permalink
Comment #4703 from Michael Healy [Reply]

I haven’t had a chance to give Popcorn Audio Converter a try yet but I’ll be sure to have a look at it soon.

Comment left November 10, 2009 at 1:50 pm with Permalink

manakeri
Comment #4722 from manakeri [Reply]

Excellent Guide keep up the god work!
I have done this, but for some reason I can only use Chapter skip on my Popcorn Hour NOT my MCE with Shark codec? any input on this?
Thanks

Comment left November 11, 2009 at 3:14 am with Permalink

Leave A Comment

Post Anonymously, Fill in your details or Use one of the Social Networks below to login and post a comment!