Page 1 of 1

MKV DTS2AC3 autoconvert script

Posted: August 20th, 2010, 4:04 pm
by thachac
Hi Guys,

A few months ago i stumbled upon the fact that i need my mkv movies to be both compatible for my PS3 and xbox360. To play a mkv on xbox360 mediacenter you need to have a AC3 stream in your mkv. Otherwise you don't have any sound output while playing through mediacenter from a xbox360.

So i started looking around and first found the popcorn MKV audio converter. It's a great tool to use but since i am downloading my files through sabnzbd, i really needed a script which is able to do this automatically when it finished downloading a MKV with a DTS stream in it. While searching the nets again to search for some sort of script i've stumbled upon the MKVDTS2AC3 bash script from JakeWharton.
The only thing with this script is the fact that it is a bash script. With 24 hrs of researching and programming i've made a solution that is running on a windows platform using cygwin (so this tutorial is also usable on linux/mac).

You need the following files:

Cygwin
MKVDTS2ACS script from JakeWharton
Libdca
Aften
mkvtoolnix


First part, installing cygwin:

First you need to install cygwin, you can lookup the installation guide on the cygwin homepage for further help.

Note: When you reach the module selection search for rsync, you will need this module for running the script correctly

After installation first start up cygwin, the program will create a home user dir for you in it's installation directory

After creating the home user dir you need to place the script and the executables from libdca, aften and mkvtoolnix into the cygwin user dir.

second part, installing required files for conversion:

Now you have 2 options for the needed binaries.

option 1, download:

download this pre-compiled package

extract the contents in the cygwin home user dir.

option 2, compile it yourself:

download the libdca and aften source files from the above links and compile them yourself through cygwin. When you want to compile the binaries yourself you will need to install a c-compiler in cygwin first, this is available by running the setup again and search for it in the modules page.

for further help compiling read the section "installing libdca" and "installing aften" on this webpage: howto-processing-multichannel-audio-dts

After compiling libdca you will need to move dcadec.exe to the home user dir
After compiling aften you will need to move aften.exe, wavfilter.exe, wavinfo.exe and wavrms.exe to the cygwin home user dir
download mkvtoolnix, extract mkvextract.exe, mkvinfo.exe, mkvmerge.exe and place them in the cygwin home user dir

third part, creating the sabnzbd post processing script:

After installing the requirements you need to make a .bat or .cmd file from the following source and add it to your sabnzbd scripts dir:
(if you didn't installed cygwin to the standard install location you will need to change the path to cygwin in the script)

Code: Select all

@echo off

CD /d %1

IF NOT EXIST *.mkv GOTO NOMKV
REN *.mkv input.mkv
CD /d C:\cygwin\bin
bash --login -i ./mkvdts2ac3.sh -k -i -d -w %1 %1\input.mkv
DEL %1\*.dts

CD /d %1
IF EXIST input.mkv REN input.mkv %3.mkv

:NOMKV
EXIT
as an option you can add these lines after CD /d %1 to delete rubbish from your movie dir

Code: Select all

DEL *sample*
DEL *.srr
DEL *.srt
DEL *.nfo
DEL *.nzb
DEL *.srs
if you want for example start mediacenter master (meta retrieval and movie management tool link) after adding the ac3 track you can do this by adding the following line before the :NOMKV line

Code: Select all

start /d "mediacenter master install dir" MediaCenterMaster.exe
you are then able to auto-process the metadata for the movie and postprocess it further in mediacenter master to your flavor.

i hope that you all will find this usefull  ;D.

Re: MKV DTS2AC3 autoconvert script

Posted: November 12th, 2011, 1:44 pm
by abray1978
HI,

Do you still have the pre-compiled bits? The link in your post is dead and I am trying to setup sab to do this exact type of conversion :P

Thx

Re: MKV DTS2AC3 autoconvert script

Posted: December 29th, 2011, 12:13 pm
by agentgreen
Here is a simple linux version of this script.

Code: Select all

cd "$1"

for i in *.mkv ; do
        echo "Found MKV converting DTS to AC3"
        /usr/local/bin/mkvdts2ac3.sh -k -i -d -w "$1" $i
        rm *.dts
        rm *.ac3
done

Re: MKV DTS2AC3 autoconvert script

Posted: January 25th, 2012, 3:35 pm
by tsheeley
abray1978 wrote:HI,

Do you still have the pre-compiled bits? The link in your post is dead and I am trying to setup sab to do this exact type of conversion :P

Thx
Check out this thread on the Plex Forum. They've got the Ubuntu version of it worked out... once I have the time I'll be playing with getting it working with Cygwin for my Win7 box and posting the results. Hopefully that'll be soon.

Re: MKV DTS2AC3 autoconvert script

Posted: October 17th, 2012, 2:02 am
by skooby
To simplify things,I created a python version of mkvdts2ac3 which will run on windows or linux:

https://github.com/dcthomson/mkvdts2ac3.py

Since sabnzbd runs on python, you'll only need to install mkvtoolnix and ffmpeg to get it all working.

As I have just completed it, let me know if there are any feature requests, or any bugs.

GL and Toodles

Re: MKV DTS2AC3 autoconvert script

Posted: February 2nd, 2014, 3:58 pm
by almi
skooby wrote:To simplify things,I created a python version of mkvdts2ac3 which will run on windows or linux:

https://github.com/dcthomson/mkvdts2ac3.py

Since sabnzbd runs on python, you'll only need to install mkvtoolnix and ffmpeg to get it all working.

As I have just completed it, let me know if there are any feature requests, or any bugs.

GL and Toodles
Would this work with Dolby True HD as well?