Converting DTS to AC3
From NMTWiki
This tutorial will allow you to convert DTS (Digital Theater Systems) Audio Stream in MKV files which Popcorn Hour cannot play due to licensing issues into AC3 Stream.
Contents |
Windows
Prerequisites
- Download and save the MKV AudioConverter
- Run it and choose to view the tutorial
- Download the various utilities required by your conversion (for DTS-to-AC3 you need MKVToolnix, eac3to and DelayCut)
Converting
- Select the source file with the Browse button
- Name the output file via the Browse button
- Click "Run"
- Sit back and wait for the finished .MKV file
Linux/OS X
Prerequisites
Download and install the following:
- mkvtoolnix - Matroska (MKV) tools
- libdca - DTS to WAV decoder
- aften - WAV to AC3 encoder
Using mkvdts2ac3
Installation
Download the latest stable version of mkvdts2ac3, a bash script for automatic DTS to AC3 conversion in matroska files, and extract the tarball.
Usage
To convert the audio simply run the script with the following command:
/path/to/mkvdts2ac3 /path/to/matroska.file.mkv
The script will automatically extract the DTS track, convert it to AC3, and merge it back into the original file.
If you would not like to retain the DTS track in the final file you can run the script with the -n argument:
/path/to/mkvdts2ac3 -n /path/to/matroska.file.mkv
Once the script has completed it will display the "Total processing time: XXX seconds" and the bash prompt will reappear. You can ensure the AC3 track has been added by running:
mkvmerge -i /path/to/matroska.file.mkv
Step by Step
Get the track information
mkvmerge -i /path/to/matroska.file.mkv
Sample output
Track ID 1: video (V_MPEG4/ISO/AVC) Track ID 2: audio (A_DTS)
This means that the matroska.file.mkv contains two tracks, a video track with id 1 and a DTS track with id 2.
Extract the DTS track
2 is the DTS track ID from the given example.
mkvextract tracks /path/to/matroska.file.mkv 2:/tmp/dts.file.dts
Converting the DTS track to AC3
dcadec -o wavall /tmp/dts.file.dts | aften - /tmp/ac3.file.ac3
Remux the AC3 track into MKV
mkvmerge -o /tmp/matroska.file.mkv /path/to/matroska.file.mkv /tmp/ac3.file.ac3
Verify
mkvmerge -i /tmp/matroska.file.mkv
Sample output
Track ID 1: video (V_MPEG4/ISO/AVC) Track ID 2: audio (A_DTS) Track ID 3: audio (A_AC3)
Delete temporary files
rm /tmp/dts.file.dts /tmp/ac3.file.ac3
Keep the DTS and the AC3 track
Move the /tmp/matroska.file.mkv to the proper directory or overwrite the original file:
mv /tmp/matroska.file.mkv /path/to/matroska.file.mkv
Remove the DTS track
3 is the AC3 Track ID from the given example (see Verify)
mkvmerge -o /tmp/matroska.file.ac3.only.mkv -a 3 /tmp/matroska.file.mkv
Move the /tmp/matroska.file.ac3.only.mkv to the proper directory or overwrite the original file:
mv /tmp/matroska.file.ac3.only.mkv /path/to/matroska.file.mkv
Possible errors
dcadec: error while loading shared libraries: libdca.so.0: cannot open shared object file: No such file or directory
Copy the libdca.so.0 to /usr/local/lib/libdca.so.0 ater you built libdca
