Jump to content


Photo

Windows Version - Convert MKV DTS Audio to AC3


  • Please log in to reply
9 replies to this topic

#1 tsheeley

tsheeley

    Member

  • Members
  • PipPip
  • 22 posts
  • Location: Southern California, USA

Posted 10 February 2012 - 05:49 AM

This process was inspired by guy2545... who was inspired by this post on the SABnzbd forum.

First off, you'll need to install Cygwin I recommend doing a full install of all the packages. It's about 200mb total. It's more than likely overkill but it'll save you from having to go back and rerun the setup again for anything that's needed if something bombs out later.

With my first attempt at this, I did only the minimal Cygwin install - I was following the post on the SAB forum pretty much to the letter... and the author didn't go into too much detail about which packages would be needed. To top it all off, the link to the additional pre-compiled packages they gave wasn't good anymore so I had to follow along with another guide on how to manually compile libdca and aften from scratch. After about the 3rd time of not having a package needed for the process, I just said screw it and did a full install. (Note: the full install might not even be needed now since we're no longer using libdca and aften noted in guy2545's post... but it wouldn't hurt.)

Next, you'll need mkvtoolnix and FFmpeg.

Extract mkvextract.exe, mkvinfo.exe, mkvmerge.exe and place the individual .EXEs in the cygwin home user dir. (For me it was: C:\cygwin\home\Tom)
Extract the FFmpeg archive into it's own ffmpeg sub-directory in the home user dir.

Finally, get the mkvdts2ac3 script and extract that into a new mkvdts2ac3 sub-directory in your home user dir.

(Note: This also requires "rsync", but that is included in the full install of Cygwin - if you want to try doing the minimal install, make sure you add the "rsync" package.)

Now, go to where your SAB scripts live and make a new batch file out of this... name it whatever you like...

@ECHO off

CD /D %1

IF NOT EXIST *.mkv GOTO NOMKV
MOVE *.mkv C:\holding\directory\input.mkv

CD /D C:\cygwin\bin
bash --login -i C:/cygwin/home/user/mkvdts2ac3/mkvdts2ac3.sh -d -n --wd C:/holding/directory C:/holding/directory/input.mkv

CD /D D:\holding\directory
MOVE input.mkv %1\%3.mkv

:NOMKV
MOVE %1 C:\processing\directory\for\cp
EXIT


Since we're blending Linix scripts with Windows, a couple items had to be hard coded instead of nicely passing the variables directly from SAB... so you'll have to change some things to suit your setup.

First, create a holding directory somewhere on your drive and change the paths in the batch... make sure you keep the slashes going the proper way on the bash portion. (The hard coding is needed because the variables passed from SAB to the linix script will have the slashes going in the wrong direction, which Cygwin removes, turning it into one long file name... and it will fail.) Next, create a processing directory and adjust the batch paths - this has to be different than your SAB downloads location and holding directory... you don't want CouchPotato trying to rename and move stuff as it's being processed. Once you have the processing directory made, adjust your CouchPotato settings to watch it instead of your SAB folder. Finally, in the Categories setup in SAB, set your movies to use the new batch file.

Here's what mine looks like for reference...

@ECHO off

CD /D %1

IF NOT EXIST *.mkv GOTO NOMKV
MOVE *.mkv D:\usenet\dts2ac3\input.mkv

CD /D C:\cygwin\bin
bash --login -i C:/cygwin/home/Tom/mkvdts2ac3/mkvdts2ac3.sh -d -n --wd D:/usenet/dts2ac3 D:/usenet/dts2ac3/input.mkv

CD /D D:\usenet\dts2ac3
MOVE input.mkv %1\%3.mkv

:NOMKV
MOVE %1 D:\usenet\processing\cp
EXIT

So, here's what this script will do...

1) move the mkv to the holding dir renamed as input.mkv
2) run the conversion script on input.mkv
3) move and rename it back to it's original location and name
4) move the entire project folder to the watched processing folder for CouchPotato to rename and sort

The entire process should only take a minute or three.

I'd also recommend going into SAB > Config > Switches and checking the box to Pause Downloading During Post-Processing. Since we're using a holding directory for the processing, having something else finish in the short time it takes to do the conversion will fire off the script and move the new download to the holding directory as input.mkv.

I've got future plans to work in some IF statements so it can also process tv shows and then pass it on to the Sick Beard processing, without having to have seperate batch files for each... but that's for another time as I'm in the process of moving to a new apartment and have a geekling being born in April. :o



Known issues:

- Can't use with multi-part movies
- Can't use with tv shows that are complete seasons in a single download


(I'll come back and edit my OP as needed as I develop this thing... or if anyone wants to throw in advice or has a better method.)

Edited by tsheeley, 10 February 2012 - 06:22 AM.


#2 MaxiP

MaxiP

    Member

  • Members
  • PipPip
  • 63 posts

Posted 27 February 2012 - 12:24 PM

Or just use Handbrake - you can run the CLI in a batch file. The script below will convert all MKV to MP4 with AAC, move them to my Sick Beard import folder & tidy up file files / folders;

REM ***Convert***
FOR /F "tokens=*" %%G IN ('DIR /B /S *.mkv') DO HandBrakeCLI -i "%%G" -o "%%G".mp4 --preset="Normal"

REM ***Copy***
copy *.mp4 d:\_SB_Import /y

REM ***Clean folder***
del *.mkv
del *.mp4



#3 tsheeley

tsheeley

    Member

  • Members
  • PipPip
  • 22 posts
  • Location: Southern California, USA

Posted 06 March 2012 - 06:04 PM

i just answered in another post as follow, hope it helps

Bigasoft MKV Converter works as outstanding MKV DTS to MKV AC3 Converter. It can fast and easily convert MKV DTS to MKV AC3, convert MKV DTS to MKV AC 5.1 or convert DTS MKV to AAC MKV with high quality. In addition, it can also convert MKV, DTS MKV to AVI, MP4, WMV, WebM, H.264, MOV, VOB, DV and more and convert MKV, DTS MKV to audio like MP3, AC3, AAC, WMA, M4A as well as convert DTS audio to like MP3, AC3, AAC, WMA, M4A.

Step by step guide at How to Convert DTS MKV to MKV AC3?



Thanks for the tip. I saw your post in the other thread as well.

#4 tsheeley

tsheeley

    Member

  • Members
  • PipPip
  • 22 posts
  • Location: Southern California, USA

Posted 06 March 2012 - 06:10 PM

Or just use Handbrake - you can run the CLI in a batch file. The script below will convert all MKV to MP4 with AAC, move them to my Sick Beard import folder & tidy up file files / folders;




I don't know much about scripting, can that be passed the variables from Sab? How long does the process take?

#5 smailpouri

smailpouri

    Newbie

  • Members
  • Pip
  • 2 posts

Posted 07 March 2012 - 04:50 PM

Hey

So i managed to make this work properly except for the 3) point part of the script: "move and rename it back to it's original location and name"

Here is how my script looks like.

@ECHO off

CD /D %1

DEL *sample*
DEL *.srr
DEL *.nfo
DEL *.nzb
DEL *.srs
DEL *.jpg

IF NOT EXIST *.mkv GOTO NOMKV
MOVE *.mkv C:\Temp\usenet\input.mkv

CD /D C:\cygwin\bin
bash --login -i C:/cygwin/home/FLORITOON/mkvdts2ac3/mkvdts2ac3.sh -d -n --wd C:/Temp/usenet C:/Temp/usenet/input.mkv

CD /D C:\Temp\usenet
MOVE input.mkv %1\%3.mkv

:NOMKV
EXIT

So basically i end up having a input.mkv file with AC3 multiplexed in it inside the "C:\Temp\Usenet" folder

Any ideas ?

#6 smailpouri

smailpouri

    Newbie

  • Members
  • Pip
  • 2 posts

Posted 09 April 2012 - 09:10 AM

Hey

So i managed to make this work properly except for the 3) point part of the script: "move and rename it back to it's original location and name"

Here is how my script looks like.

@ECHO off

CD /D %1

DEL *sample*
DEL *.srr
DEL *.nfo
DEL *.nzb
DEL *.srs
DEL *.jpg

IF NOT EXIST *.mkv GOTO NOMKV
MOVE *.mkv C:\Temp\usenet\input.mkv

CD /D C:\cygwin\bin
bash --login -i C:/cygwin/home/FLORITOON/mkvdts2ac3/mkvdts2ac3.sh -d -n --wd C:/Temp/usenet C:/Temp/usenet/input.mkv

CD /D C:\Temp\usenet
MOVE input.mkv %1\%3.mkv

:NOMKV
EXIT

So basically i end up having a input.mkv file with AC3 multiplexed in it inside the "C:\Temp\Usenet" folder

Any ideas ?


So i found out that if if i try the script with a file, ot does not put it back to parent directory but if i try with a Folder, the file inside that folder comes back to it after converting.

But Still the script does not rename the MKV file to its original name.

Any ideas ?

#7 skooby

skooby

    Newbie

  • Members
  • Pip
  • 3 posts

Posted 17 October 2012 - 07:07 AM

To simplify things,I created a python version of mkvdts2ac3 which will run on windows or linux:

https://github.com/d...n/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

#8 adam@thebrayhouse.com

adam@thebrayhouse.com

    Newbie

  • Members
  • Pip
  • 1 posts

Posted 21 October 2012 - 12:35 AM

FYI - I've written a .NET Console App that takes the logic that Jake Wharton put into his script and allows for SABNZBD to easily convert DTS to AC3 on Windows without needing any special hacks. I just finished writing it and am putting it through some tests now.

https://github.com/abray1978/ConvertDTStoAC3

Here is my sabnzbd script that calls this app to convert:

@ECHO off

CD /D %1

D:\Convert\ConvertDTStoAC3.exe -debug -mvktoolnixpath d:\Convert -ffmpegpath d:\Convert -sedpath d:\Convert -source %1


#9 danielponte

danielponte

    Member

  • Members
  • PipPip
  • 85 posts

Posted 30 January 2013 - 01:37 AM

Hey Adam, how can I edit your script and recompile it? I'd like to change a couple things if you allow me, like renaming the final file to the same name of the original file...

Could you help me out or just recompile it for me with this change I'm proposing? THanks!

FYI - I've written a .NET Console App that takes the logic that Jake Wharton put into his script and allows for SABNZBD to easily convert DTS to AC3 on Windows without needing any special hacks. I just finished writing it and am putting it through some tests now.

https://github.com/abray1978/ConvertDTStoAC3

Here is my sabnzbd script that calls this app to convert:

@ECHO off

CD /D %1

D:\Convert\ConvertDTStoAC3.exe -debug -mvktoolnixpath d:\Convert -ffmpegpath d:\Convert -sedpath d:\Convert -source %1



#10 danielponte

danielponte

    Member

  • Members
  • PipPip
  • 85 posts

Posted 30 January 2013 - 01:41 AM

I tried using your script, but my Python told me some errors when running it, like invalid syntax on many lines, starting at 161... :(

I'm using Pythin 3.2, which I used to run a few scripts before...

To simplify things,I created a python version of mkvdts2ac3 which will run on windows or linux:

https://github.com/d...n/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






0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users