Going from DTS to AC3 in Mac OS from MKV

Discussion in 'Apple TV and Home Theater' started by nando2323, Dec 16, 2009.

  1. nando2323 macrumors 6502a

    Aug 15, 2007
    I am not the one that came up with these scripts or procedures but I think this is very valuable information for the people in this forum.

    First you need to install X-Code from you Leopard/SL OS Install disc.

    Then in Terminal do these in this order. (Not the bold parts :) be sure also to hit enter at the end of every time just to make sure that part is done, before going on to the next part)

    mkdir /ConverterTemp

    This installs CMake

    cd /ConverterTemp/
    curl -O [url]http://www.cmake.org/files/v2.6/”[/url] && cmake_install && tar xvzf  && cmake_install
    sudo make install
    This installs Aften

    cd /ConverterTemp
    svn co [url]http://aften.svn.sourceforge.net/svnroot/aften[/url] Aften
    cd Aften
    mkdir default
    cd default
    cmake /ConverterTemp/Aften/
    sudo make install
    This installs MKVInfo

    cd /ConverterTemp
    curl -O [url]http://iamthekiller.net/downloads/mkvinfo.zip[/url]
    unzip mkvinfo.zip
    sudo chmod 755 mkvinfo
    sudo cp mkvinfo /usr/local/bin
    This installs libdca

    cd /ConverterTemp
    svn co svn://svn.videolan.org/libdca/trunk libdca
    cd libdca
    sudo ./bootstrap
    sudo ./configure
    sudo make
    sudo make install
    This installs MKVDTS2AC3

    cd ConverterTemp
    curl -O [url]http://iamthekiller.net/downloads/mkvdts2ac3.zip[/url]
    unzip mkvdts2ac3.zip
    cd mkvdts2ac3
    sudo chmod 755 mkvdts2ac3.sh
    cp /ConverterTemp/mkvdts2ac3/mkvdts2ac3.sh /ConverterTemp/mkvdts2ac3/mkvdts2ac3
    sudo cp /ConverterTemp/mkvdts2ac3/mkvdts2ac3 /usr/local/bin/
    This installs MKVMerge

    cd /ConverterTemp
    curl -O [url]http://iamthekiller.net/downloads/mkvmerge[/url]
    sudo chmod 755 mkvmerge
    cp mkvmerge /usr/local/bin/
    This installs MKVExtract

    cd /ConverterTemp
    curl -O [url]http://iamthekiller.net/downloads/mkvextract[/url]
    sudo chmod 755 mkvextract
    Once you are done all you have to do is open up Terminal and type:

    (then drag the file you want to the terminal, or type out the path make sure you put a space in between the file and the command :))

    you can also do

    mkvdts2ac3 -n
    (if you do not want to keep the original DTS track and only the AC3 track)

    After a few minutes depending on your machine you should now have an AC3 track in your MKV.

    Credit goes to. L. Preston Sego III http://www.lprestonsegoiii.com/
  2. nigelw macrumors newbie

    May 1, 2010
    @nando, thanks for the detailed instructions. I'm running into an error when trying to build cmake. Although I have the latest xcode dev tools installed, after downloading cmake, when I run "./configure", I get the following message:

    Error when bootstrapping CMake:
    Cannot find appropriate C compiler on this system.
    Please specify one using environment variable CC.
    See cmake_bootstrap.log for compilers attempted.
    Any idea how to resolve this? I appreciate any help.
  3. DoFoT9 macrumors P6


    Jun 11, 2007
    just chiming in, will attempt this later i hope it works :)
  4. dynaflash macrumors 68020

    Mar 27, 2003
    might be time for a cocoa utility to do this ... hmmmm. ?
  5. DoFoT9 macrumors P6


    Jun 11, 2007
    :eek: yes please!!! :D
  6. dynaflash macrumors 68020

    Mar 27, 2003
    Played with it a bit ... its a bit tricky but works. Probably best just done in hb though. No ... its not in hb *yet*.
  7. DoFoT9 macrumors P6


    Jun 11, 2007
    so this basically converts DTS to AC3 - then after that we can use HB to convert into m4v or what ever. hmm
  8. ixxx69 macrumors 65816

    Jul 31, 2009
    United States
    Wow, what a great thread... amazing it went months without anyone seeming to notice it.

    Unfortunately, some of the links have gone bad.

    This is how I got it to work:

    Aside from needing CMake in order to compile Aften and libdca, the installation order doesn't matter.

    Download CMake dmg installer for OS X and install. No need to compile yourself.

    Follow Aften instructions described in OP.

    MKVToolNix (MKVInfo/MKVMerge/MKVExtract):
    All these "original" tools are included in MKVToolNix. Download mkvtoolnix dmg and install (I used "JonThn from doom9" version). No need to compile yourself. Be sure to read the README (included as part of the dmg) for setting up the necessary command line links.

    Follow libdca instructions described in OP.

    The original script by Jake Wharton and Chris Hoekstra.
    There's also a new version written in python that might be worth checking out:

    Follow instructions described in OP to install script (changing folder/file names as appropriate). Optionally, skip the renaming and moving to bin and just keep the script in whatever working folder you're using for your conversions.

    Run mkvdts2ac3 with no arguments to see list of options.

    I used the -n & -f options to remove the DTS and force processing, e.g.:
    mkvdts2ac3 -n -f <filename>

    By default, the script will overwrite your existing file.

    It takes a while to process. Total processing time for a ~20GB (90 min) file took about 20 minutes on my setup. YMMV. If you're concerned it has stopped working, pay attention to the script output verbiage and check the /tmp folder (invisible by default) and you should see your file being processed.

    Workflow I used:
    makemkv: rip.
    mkvdts2ac3: strip out DTS.
    handbrake: mkv to m4v for AppleTV.

    This was very straightforward for a straightforward movie. Chapters worked, surround sound worked. Subtitles, etc. may involve additional steps.

    AFAIK, actual credit for the script and process goes to Jake Wharton and Chris Hoekstra.

    I have no idea how any of this works, so don't ask me. ;-) I was just trying to follow the OP and tracked down the broken links (which will probably be broken again before long).
  9. Mr Dobey macrumors 6502

    Aug 8, 2008
  10. emmgunn macrumors member

    Jul 7, 2008
    Hi All,
    I've been fiddling around with 5.1 DTS to 5.1 AC3 conversion for MKVtools and I think that I've got it working properly. I can't test on an ATV, but when I convert these files to avi files for DivX certified DVD players, the channels sound right to me.

    For those of you who want to use applications like handbrake, and are finding DTS audio to be a stumbling block, I thought I'd put the audio conversion code in a applescript droplet. You'll find it on my beta download page. Just drop your MKV file on the droplet, enter the track number to use (#1 is the first audio track), and it should spit out a ac3 file for you to use. It's a quick and dirty script with no error trapping so be gentle with it :). Note, some of my test files sounded off when I tried it on the computer, but once played through my AVR, they sounded great. Hopefully it works for you.
  11. BNJMN macrumors newbie

    Aug 17, 2010
    Thanks for the guide. I've installed everything and it all went fine. I then converted an .mkv with no apparent problems whatsoever. However, when I open the resulting .mkv in Quicktime 7 (with Perian) there is no sound despite the fact that QT recognises that there is an ac3 video track in the file. Also when I try to mux the file in Subler into an mp4 the resulting file is corrupt.

    The mkv plays ok in VLC but I want to be able to mux the file to mp4 using Subler so I can play it through iTunes/Plex. Has anyone else encountered this problem/know how to solve it?
  12. pirateRACE macrumors 6502

    Feb 1, 2010
    I know this is an old thread, but I was wondering if anyone who is using this has found a way to batch process this stuff.

    I've been using it for TV shows and have been manually typing in the command line for each episode in terminal and it takes forever!

    Additionally, what audio settings are you using in Handbrake. I want a 5.1 and a fall back stereo mix for when used on TV without surround sound.

    Thanks in advance.
  13. BlackMangoTree macrumors 6502a

    Sep 30, 2010
    The above way to convert to AC3 is long and complicated.

    Anyone wants to convert DST or AAC 5.1 to AC3 for the Apple TV can use MKVtools it's free to use and $5 to remove the nagging screen. and does the job so simple and works perfectly.


    The latest beata of the app is actually very very nice app. Worth every cent.
  14. pirateRACE macrumors 6502

    Feb 1, 2010
    Thanks for the post. Interesting little app. Seems to be kinda like Handbrake but it makes an mp4 instead of m4v. Not sure what difference that would make for iTunes. I think m4v has advanced tagging.

    How does the encoding compare to Handbrake? What settings would you recommend for a 1080p Blu-ray rip to AppleTV?
  15. rayward macrumors 68000

    Mar 13, 2007
    Houston, TX
    Please forgive an potentially ignorant question. I have been ripping BDs for Apple TV for a while now using Handbrake, and I have been happy. However, an AC3 track (required for a passthrough track, I believe, and I have a 5.1 receiver in my home theater) is not always available after ripping the file with MakeMKV.

    So, my question is, should I use MKVTools instead of HB to get an AC3 track? Or, does it create an AC3 track on the .mkv file, that will then show up in HB?

    I may have just lost my media library (because I procrastinated about getting external storage to back it up), so I am faced with the possibility of having to re-encode everything. In that case, I want to make sure that I use the best tools with the best settings.

    I like the idea that it can burn in a forced subtitle track too.
  16. Diode macrumors 68020


    Apr 15, 2004
    Washington DC
    The idea is to use this tool to make a MKV with AC3 (instead of DTS) that can then be used by handbrake to process as normal.
  17. rayward macrumors 68000

    Mar 13, 2007
    Houston, TX
    OK, thanks.
  18. rkuo macrumors 6502a

    Sep 25, 2010
    You may find it easier for a one off to use a GUI, but a batch file like this is very convenient for scripting purposes.
  19. dynaflash macrumors 68020

    Mar 27, 2003
    ... or you might want to just wait for the next hb nightly ....
  20. bukiwhitey macrumors newbie

    Jul 29, 2009
    What will that do?
  21. NightStorm macrumors 68000

    Jan 26, 2006
    Whitehouse, OH
    Take a guess... I'll give you a hint: it's in the topic for this thread.
  22. bukiwhitey macrumors newbie

    Jul 29, 2009
    Is the handbrake server down
  23. BlackMangoTree macrumors 6502a

    Sep 30, 2010
    I hear from a good source it will allow iApps on your Apple TV.
  24. GermanSuplex macrumors 6502a


    Aug 26, 2009
    m4v is just an iTunes/Apple-friendly extension. For some reason, certain videos with chapters and/or an AC-3 track won't add to or play nice with iTunes without a .m4v extension.

    There's no difference, the extensions are interchangeable. Most programs like VLC or WMP will open either regardless of the extension, since they don't read the metadata like iTunes does.

    If the program puts out a .mp4 file, just rename the extension to .m4v manually.
  25. pirateRACE macrumors 6502

    Feb 1, 2010
    That would be wonderful! :)

Share This Page