Skip to content

Commit

Permalink
Update script to use ffmpeg. Refs JakeWharton#57.
Browse files Browse the repository at this point in the history
  • Loading branch information
JakeWharton committed Dec 22, 2011
1 parent 9215577 commit 61f4f38
Show file tree
Hide file tree
Showing 4 changed files with 13 additions and 16 deletions.
4 changes: 4 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,10 @@ Change Log
Version 1.5.8 *(In Development)*
--------------------------------

New Features:

* Script now uses `ffmpeg` instead of `libdca`/`aften` for better conversion.

Bug Fixes:

* Ensure proper audio output mode is displayed when logging verbosely.
Expand Down
11 changes: 5 additions & 6 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -10,9 +10,8 @@ Prerequisites
Make sure the executables for the following libraries are accessible.

1. [mkvtoolnix](http://www.bunkus.org/videotools/mkvtoolnix/) - Matroska tools
2. [libdca](http://videolan.org/developers/libdca.html) - DTS to WAV decoder
3. [aften](http://aften.sourceforge.net/) - WAV to AC3 encoder
4. [rsync](http://rsync.samba.org/) - File transfer and synchronization
2. [ffmpeg](http://ffmpeg.org/) - Audio conversion tool
3. [rsync](http://rsync.samba.org/) - File transfer and synchronization

*Note: If you are a Mac OS X user you may need to compile these libraries.*

Expand Down Expand Up @@ -57,7 +56,6 @@ argument.
--md5 Perform MD5 comparison when copying across drives.
-n, --no-dts Do not retain the DTS track.
--new Do not copy over original. Create new adjacent file.
-o MODE Pass a custom audio output mode to libdca.
-p PRIORITY Modify niceness of executed commands.
-s MODE,
--compress MODE Apply header compression to streams (See mkvmerge's --compression).
Expand Down Expand Up @@ -89,7 +87,6 @@ configuration file to automatically set them. Copy the following to
#NOCOLOR=1
#MD5=1
#NEW=1
#AUDIOMODE=
#PRIORITY=0
#DTSTRACK=
#DTSNAME=
Expand Down Expand Up @@ -170,7 +167,7 @@ before running each.
Extract DTS file from MKV.
> mkvextract tracks "Some.Random.Movie.mkv" 3:"/mnt/media/tmp/Some.Random.Movie.dts"
Converting DTS to AC3.
> dcadec -o wavall "/mnt/media/tmp/Some.Random.Movie.dts" | aften - "/mnt/media/tmp/Some.Random.Movie.ac3"
> ffmpeg -i "/mnt/media/tmp/Some.Random.Movie.dts" -acodec ac3 -ac 6 -ab 448k "/mnt/media/tmp/Some.Random.Movie.ac3"

Running main remux.
> nice -n 0 mkvmerge -q -o "/mnt/media/tmp/Some.Random.Movie.new.mkv" --compression 1:none "Some.Random.Movie.mkv" --default-track 0 --language 0:DTSLANG --track-name 0:"DTSNAME" --sync 0:DELAY --compression 0:none "/mnt/media/tmp/Some.Random.Movie.ac3"
Expand Down Expand Up @@ -215,6 +212,8 @@ The following people contributed useful thoughts or code to `mkvdts2ac3`:
* Daniele Nicolucci - `df` portability fixes.
* Florian Coulmier - Bug reports and patches.
* NameLessJedi - Header compression disabling suggestion.
* d4nyl0 - Transition to ffmpeg
* n-i-x - Progress display on file copy

And to everyone who submitted bug reports through email and on networkedmediatank.com!

Expand Down
12 changes: 3 additions & 9 deletions mkvdts2ac3.sh
Original file line number Diff line number Diff line change
Expand Up @@ -69,7 +69,6 @@ displayhelp() {
echo " --md5 Perform MD5 comparison when copying across drives."
echo " -n, --no-dts Do not retain the DTS track."
echo " --new Do not copy over original. Create new adjacent file."
echo " -o MODE Pass a custom audio output mode to libdca."
echo " -p PRIORITY Modify niceness of executed commands."
echo " -s MODE,"
echo " --compress MODE Apply header compression to streams (See mkvmerge's --compression)."
Expand Down Expand Up @@ -352,8 +351,7 @@ if [ $EXECUTE = 1 ]; then
checkdep mkvmerge
checkdep mkvextract
checkdep mkvinfo
checkdep dcadec
checkdep aften
checkdep ffmpeg
checkdep rsync
fi

Expand Down Expand Up @@ -497,17 +495,13 @@ fi

# ------ CONVERSION ------
# Convert DTS to AC3
if [ -z $AUDIOMODE ]; then
AUDIOMODE="wavall"
fi

doprint $"Converting DTS to AC3."
doprint "> dcadec -o $AUDIOMODE \"$DTSFILE\" | aften - \"$AC3FILE\""
doprint "> ffmpeg -i \"$DTSFILE\" -acodec ac3 -ac 6 -ab 448k \"$AC3FILE\""

dopause
if [ $EXECUTE = 1 ]; then
color YELLOW; echo $"Converting DTS to AC3:"; color OFF
nice -n $PRIORITY dcadec -o $AUDIOMODE "$DTSFILE" 2> /dev/null | nice -n $PRIORITY aften -v 0 - "$AC3FILE"
nice -n $PRIORITY ffmpeg -i "$DTSFILE" -acodec ac3 -ac 6 -ab 448k "$AC3FILE"
checkerror $? $"Converting the DTS file to AC3 failed" 1
DTSFILESIZE=$($DUCMD "$DTSFILE" | cut -f1) # Capture DTS filesize for end summary

Expand Down
2 changes: 1 addition & 1 deletion mkvdts2ac3_dpkg.txt
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ Section: security
Priority: optional
Architecture: all
Essential: no
Depends: rsync, mkvtoolnix, libdca-utils, aften
Depends: rsync, mkvtoolnix, ffmpeg
Installed-Size: 20k
Maintainer: Jake Wharton <JakeWharton@GMail.com>
Description: a bash script which can be used for converting the DTS in Matroska (MKV) files to AC3.

0 comments on commit 61f4f38

Please sign in to comment.