Convert DTS CD files to Dolby Digital on Linux?

Help Support QuadraphonicQuad:

ashr1565

Active Member
Joined
Dec 29, 2019
Messages
54
Location
Canada
Forgive me if this is in the wrong section, but I'm using Manjaro Linux KDE and want to take the .flac files I ripped off a DTS CD and make them into dolby digital because I have an old receiver upstairs. I tried MKVtoolnix gui but it just sees them as flac despite me changing the extension to .dts, and I couldn't find dolby/dts options anyway. Any help? Thanks.
 

winopener

2K Club - QQ Super Nova
Since 2002/2003
Joined
Mar 2, 2002
Messages
3,735
Forgive me if this is in the wrong section, but I'm using Manjaro Linux KDE and want to take the .flac files I ripped off a DTS CD and make them into dolby digital because I have an old receiver upstairs. I tried MKVtoolnix gui but it just sees them as flac despite me changing the extension to .dts, and I couldn't find dolby/dts options anyway. Any help? Thanks.
Ripping a dtscd in flac is useless but tagging, because the audio is already in a compressed form and the flac engine can't do anything serious for a DATA format.
Try to rip one of these dtscd as WAVE file and see if MKVtoolnix works. I'm not using Linux platform for audio stuff so i can't suggest more.
 

ashr1565

Active Member
Joined
Dec 29, 2019
Messages
54
Location
Canada
Ripping a dtscd in flac is useless but tagging, because the audio is already in a compressed form and the flac engine can't do anything serious for a DATA format.
Try to rip one of these dtscd as WAVE file and see if MKVtoolnix works. I'm not using Linux platform for audio stuff so i can't suggest more.
Intereting, why does wav work but flac won't?
 

winopener

2K Club - QQ Super Nova
Since 2002/2003
Joined
Mar 2, 2002
Messages
3,735
Because the dts cd format has been designed to be disguised as PCM Audio 44100/16/2 but in reality is a data track - as if it was a Zip file holding inside 6 channels MP3. DTS-enabled software can recognize the dts header on a wave file and switch to the appropriate mode, while on flac files it may pay no attention of a different and subsequent header than the first flac one.
 

himey

1K Club - QQ Shooting Star
Joined
Nov 11, 2013
Messages
1,481
Forgive me if this is in the wrong section, but I'm using Manjaro Linux KDE and want to take the .flac files I ripped off a DTS CD and make them into dolby digital because I have an old receiver upstairs. I tried MKVtoolnix gui but it just sees them as flac despite me changing the extension to .dts, and I couldn't find dolby/dts options anyway. Any help? Thanks.
So your old receiver does ac3 and not dts? That IS old! I know Plex will convert the dts audio of movies to ac3 on the fly. Maybe it can with audio files?
 

winopener

2K Club - QQ Super Nova
Since 2002/2003
Joined
Mar 2, 2002
Messages
3,735
Don't forget you MUST resample the 44100 dts-decoded multichannel wave files to 48000 before compressing into AC3: that's because 44100 is a valid sample rate for dts but NOT valid for Ac3, which has 48000 as the standard. Otherwise, it will or refused by the encoder, or if encoded it will playback at wrong speed.

If your receiver has a multichannel analog input it's less troublesome to connect a old machine with a 6 channel soundcard, or a dvd player that decodes internally dts and ac3.
 

himey

1K Club - QQ Shooting Star
Joined
Nov 11, 2013
Messages
1,481
Don't forget you MUST resample the 44100 dts-decoded multichannel wave files to 48000 before compressing into AC3: that's because 44100 is a valid sample rate for dts but NOT valid for Ac3, which has 48000 as the standard. Otherwise, it will or refused by the encoder, or if encoded it will playback at wrong speed.

If your receiver has a multichannel analog input it's less troublesome to connect a old machine with a 6 channel soundcard, or a dvd player that decodes internally dts and ac3.
My question is once you use Audiomuxer to wrap the dts within a flac, can you turn THAT back into a standard wav?
 

winopener

2K Club - QQ Super Nova
Since 2002/2003
Joined
Mar 2, 2002
Messages
3,735
Never used audiomuxer.
It should be possible.
 

himey

1K Club - QQ Shooting Star
Joined
Nov 11, 2013
Messages
1,481
Never used audiomuxer.
It should be possible.
There is a feature in Audiomuxer specifically designed to put dts and ac3 files in a wav or flac wrapper. Even 24/96 dts files work too. But my question is can the origional dts be extracted from the conversion. I don't think it can but I am not sure. ...also that leads to the question if or how to take that wrapped dts file and turn it into a standard flac to make it more compatable with some media players and organizers.

For example, if you try to do a shuffle play of mixed standard multichannel flac files and flac files that are actually dts, some players will choke on the change over.
 

atrocity

1K Club - QQ Shooting Star
Since 2002/2003
Joined
Jun 14, 2002
Messages
1,607
Location
Sacramento, California
Just to steal/compile what others have said and add my own gibberish on top of it:

Any WAV or FLAC file containing a DTS-encoded signal is, by design, going to look like normal stereo to anything but a DTS decoder.

Consequently, the first thing you'll need to do is decode the original "two channel" (as most software will see it) lossy encoded DTS file to a six-channel WAV file. The actual contents of that file will still be lossy, but there's no way around that. I don't think any DD/AC-3 encoder is going to be designed to first check if a WAV file actually contains DTS-encoded material, so if you simply try to encode the extracted DTS as is you'll just wind up with noise. I don't know if Linux tools like ffmpeg can do the conversion, but I'd probably start there.

Then you will probably need to convert that WAV file, which will be 44.1kHz if you ripped it from CD, to 48kHz. I have heard rumors that some hardware will play back DD at 44.1 kHz, but the only time I ever tried I just got silence.

That 48kHz WAV file can then be encoded to Dolby Digital.

Be aware that you will be starting with a file that has already undergone significant lossy compression, then you'll be manipulating the sample rate, then converting the results of that to an even lossier format. I'm not insisting that you'll be able to hear (or be bothered by) the chained processing against an already lossy source, but it's certainly possible.

Also, I don't know if there's a real risk of this or not, but my gut tells me that there's a possibility that AC-3 and DTS will handle "frames" differently, so you may find that if you process everything as individual tracks you'll hear disruptions at any break where the two tracks are supposed to flow seamlessly. Hopefully I'm wrong, but if not you may need to process the entire album as a single file and split it back out later.

The good news is that you're OK with Linux, so you can probably figure out how to script the whole thing fairly easily.
 

ashr1565

Active Member
Joined
Dec 29, 2019
Messages
54
Location
Canada
So your old receiver does ac3 and not dts? That IS old! I know Plex will convert the dts audio of movies to ac3 on the fly. Maybe it can with audio files?
Yup! Upstairs I have a Kenwood VR-405 that only does Dolby Digital AC3. And my PC upstairs has no optical out, and the receiver has no multichannel inputs... A pickle to be sure!
 

ashr1565

Active Member
Joined
Dec 29, 2019
Messages
54
Location
Canada
Just to steal/compile what others have said and add my own gibberish on top of it:

Any WAV or FLAC file containing a DTS-encoded signal is, by design, going to look like normal stereo to anything but a DTS decoder.

Consequently, the first thing you'll need to do is decode the original "two channel" (as most software will see it) lossy encoded DTS file to a six-channel WAV file. The actual contents of that file will still be lossy, but there's no way around that. I don't think any DD/AC-3 encoder is going to be designed to first check if a WAV file actually contains DTS-encoded material, so if you simply try to encode the extracted DTS as is you'll just wind up with noise. I don't know if Linux tools like ffmpeg can do the conversion, but I'd probably start there.

Then you will probably need to convert that WAV file, which will be 44.1kHz if you ripped it from CD, to 48kHz. I have heard rumors that some hardware will play back DD at 44.1 kHz, but the only time I ever tried I just got silence.

That 48kHz WAV file can then be encoded to Dolby Digital.

Be aware that you will be starting with a file that has already undergone significant lossy compression, then you'll be manipulating the sample rate, then converting the results of that to an even lossier format. I'm not insisting that you'll be able to hear (or be bothered by) the chained processing against an already lossy source, but it's certainly possible.

Also, I don't know if there's a real risk of this or not, but my gut tells me that there's a possibility that AC-3 and DTS will handle "frames" differently, so you may find that if you process everything as individual tracks you'll hear disruptions at any break where the two tracks are supposed to flow seamlessly. Hopefully I'm wrong, but if not you may need to process the entire album as a single file and split it back out later.

The good news is that you're OK with Linux, so you can probably figure out how to script the whole thing fairly easily.
So Rip DTS CD -> decode ripped DTS stream into six channel wav -> convert to 48khz -> encode as dolby digital? Sheesh, sounds annoying but thank you for the good summary.
 

winopener

2K Club - QQ Super Nova
Since 2002/2003
Joined
Mar 2, 2002
Messages
3,735
Yup! Upstairs I have a Kenwood VR-405 that only does Dolby Digital AC3. And my PC upstairs has no optical out, and the receiver has no multichannel inputs... A pickle to be sure!
Quite limited possibilities with this, but it does have not only optical input but also coax (two vertical orange plugs), so if you have a spdif-out on your motherboard you're nearly set.
I say nearly because there is a level difference between TTL-Spdif typical of mobos and cd-rom drive digital out (5 volt) and the 0,5 Volt fo the coax in. So:
1) If you have a rca connector out of your pc that says spdif (mobo or soundcard), you're set
2) If you don't have it, but you have a spdif out on the mobo, you need just this schematic to lower down the levels:

A 100nF
TTL ----||-----330ohm--+--------- coax S/PDIF signal out
in |
100ohm
|
Ground -----------------+--------- coax signal ground

(the forum software eliminates blank spaces, the 100 ohm is connected between the two + signs
 

winopener

2K Club - QQ Super Nova
Since 2002/2003
Joined
Mar 2, 2002
Messages
3,735
So Rip DTS CD -> decode ripped DTS stream into six channel wav -> convert to 48khz -> encode as dolby digital? Sheesh, sounds annoying but thank you for the good summary.
Two radical alternative solutions:
1) get a new one on a flea market (that was easy...)
2) find the traces of the 5.1 out of the Dolby Digital decoder and solder there 6 shielded cables with rca plugs, so you have 5.1 analog in for any use (that isn't easy but it is doable).
 

ashr1565

Active Member
Joined
Dec 29, 2019
Messages
54
Location
Canada
Two radical alternative solutions:
1) get a new one on a flea market (that was easy...)
2) find the traces of the 5.1 out of the Dolby Digital decoder and solder there 6 shielded cables with rca plugs, so you have 5.1 analog in for any use (that isn't easy but it is doable).
I'm waiting to get my Onkyo 605 back from repair so my HK 1565 can go back up to the bedroom! :p
 

jonmchugh

Active Member
Joined
May 5, 2019
Messages
56
Location
UK
Forgive me if this is in the wrong section, but I'm using Manjaro Linux KDE and want to take the .flac files I ripped off a DTS CD and make them into dolby digital because I have an old receiver upstairs. I tried MKVtoolnix gui but it just sees them as flac despite me changing the extension to .dts, and I couldn't find dolby/dts options anyway. Any help? Thanks.
Linux can do anything, I don't know how people cope using windows, its so limited.

Here is the command you need to do what you ask...
Code:
 ffmpeg -i music.flac -f wav - | ffmpeg -acodec dca -i - music.ac3
 

jonmchugh

Active Member
Joined
May 5, 2019
Messages
56
Location
UK
If you receiver will not accept 44khz dolby digital you will need to convert to 48khz using this.

Code:
ffmpeg -i music.flac -f wav - | ffmpeg -acodec dca -i - -af aresample=resampler=soxr -ar 48000 music.ac3
 

winopener

2K Club - QQ Super Nova
Since 2002/2003
Joined
Mar 2, 2002
Messages
3,735
If you receiver will not accept 44khz dolby digital you will need to convert to 48khz using this.

Code:
ffmpeg -i music.flac -f wav - | ffmpeg -acodec dca -i - -af aresample=resampler=soxr -ar 48000 music.ac3
No receiver should accept 44.1KHz Dolby Digital, it's out of specs.
 
Top