Going from DTS to AC3 in Mac OS from MKV

nando2323

macrumors 6502a
Original poster
Aug 15, 2007
662
0
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

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

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

Code:
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

Code:
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

Code:
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

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

Code:
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:

Code:
mkvdts2ac3
(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

Code:
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/
 

nigelw

macrumors newbie
May 1, 2010
2
0
@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:

Code:
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.
 

dynaflash

macrumors 68020
Mar 27, 2003
2,119
5
Played with it a bit ... its a bit tricky but works. Probably best just done in hb though. No ... its not in hb *yet*.
 

ixxx69

macrumors 65816
Jul 31, 2009
1,119
635
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:

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

CMake:
Download CMake dmg installer for OS X and install. No need to compile yourself.
http://www.cmake.org/cmake/resources/software.html

Aften:
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.
http://www.bunkus.org/videotools/mkvtoolnix/downloads.html

libdca:
Follow libdca instructions described in OP.

MKVDTS2AC3
The original script by Jake Wharton and Chris Hoekstra.
http://github.com/JakeWharton/mkvdts2ac3
There's also a new version written in python that might be worth checking out:
http://github.com/JakeWharton/mkvdts2ac3/tree/future

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.

Usage:
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).
 

emmgunn

macrumors member
Jul 7, 2008
94
0
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.
 

BNJMN

macrumors newbie
Aug 17, 2010
1
0
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?
 

pirateRACE

macrumors 6502
Feb 1, 2010
250
19
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.
 

BlackMangoTree

macrumors 6502a
Sep 30, 2010
896
2
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.

http://www.emmgunn.com/mokgvm2dvd/mokgvmhome.html

The latest beata of the app is actually very very nice app. Worth every cent.
 

pirateRACE

macrumors 6502
Feb 1, 2010
250
19
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.

http://www.emmgunn.com/mokgvm2dvd/mokgvmhome.html

The latest beata of the app is actually very very nice app. Worth every cent.
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?
 

rayward

macrumors 68000
Mar 13, 2007
1,608
53
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.
 

Diode

macrumors 68020
Apr 15, 2004
2,371
38
Washington DC
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.
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.
 

rkuo

macrumors 6502a
Sep 25, 2010
593
192
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.

http://www.emmgunn.com/mokgvm2dvd/mokgvmhome.html

The latest beata of the app is actually very very nice app. Worth every cent.
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.
 

GermanSuplex

macrumors 6502a
Aug 26, 2009
963
9,937
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.
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.