Skip to main content

Notice

Please note that most of the software linked on this forum is likely to be safe to use. If you are unsure, feel free to ask in the relevant topics, or send a private message to an administrator or moderator. To help curb the problems of false positives, or in the event that you do find actual malware, you can contribute through the article linked here.
Topic: How to extract dts from dts-wav (Read 18131 times) previous topic - next topic
0 Members and 1 Guest are viewing this topic.

How to extract dts from dts-wav

I have some dts files from a Telarc CD. I want to edit them in Audacity, but Audacity cannot read them. I tried using eac3to to convert them to FLAC files, but eac3to sees them only as wav files.  This is because the dts-cd files have to conform to redbook CD format and are not typical dts files. Instead they have additional header information in them making them conform to 44.1k LPCM (I think).

If I could extract the dts file from the dts-wav file that I have now, eac3to should convert them to FLAC or WAV which will allow me to edit these files.

I could not find any options in eac3to to force it to read beyond the header info to detect dts.

If anyone has been able to do this I would appreciate your approach.


note: please no replies asking "why do you want to edit these files?"  I just do!

How to extract dts from dts-wav

Reply #1
foobar can read DTS WAV. You can use it to save to a linear WAV file

How to extract dts from dts-wav

Reply #2
foobar can read DTS WAV. You can use it to save to a linear WAV file

So I've found out how to convert DTS-CD's to normal multichannel wave files by adding the ripped files to a playlist, then right click and select convert.  This also works directly from a CD (but then you have to manually rename all the files).  My question is that these DTS-CD's are supposed to be 20 bit, but the decoded (converted) files all come out as 16 bit.  It would be desirable to save as 20 bit or 24 bit files as resolution is being lost. Playback setting in Foobar is set to 24 bit.  Any comments or ideas?

How to extract dts from dts-wav

Reply #3
I'm not at all sure if this works, but you may try this tool that I made a long time ago to extract the MP3 stream from a WAV file:
http://mark0.net/soft-riffstrip-e.html

If it's just a DTS stream encapsulated in a WAV container, it may works.

How to extract dts from dts-wav

Reply #4
foobar can read DTS WAV. You can use it to save to a linear WAV file

So I've found out how to convert DTS-CD's to normal multichannel wave files by adding the ripped files to a playlist, then right click and select convert.  This also works directly from a CD (but then you have to manually rename all the files).  My question is that these DTS-CD's are supposed to be 20 bit, but the decoded (converted) files all come out as 16 bit.  It would be desirable to save as 20 bit or 24 bit files as resolution is being lost. Playback setting in Foobar is set to 24 bit.  Any comments or ideas?

Further checking the bit depth for the converted files can be changed from auto to 24 bit, resulting in 24 bit output files, however I'm unsure if these files contain any extra information above that of the 16 bit output that is automatically selected.
The information about the DTS decoder states "a decode postprocessor which supports decoding DTS streams from 44100Hz or 48KHz 16-bit lossless PCM streams".  If the decoder is limited to extracting 16 bit data up-converting to 24 bit would serve no purpose.


How to extract dts from dts-wav

Reply #6
Tranzcode 0.40 beta will allow to output 6 mono waves that you can then edit & do whatever you need in the end

eac3to will also do it

As will azidts

Re: How to extract dts from dts-wav

Reply #7
I needed to do the same thing again, and web search brought me back here (forgot I even posted in this thread years ago)

DTS CD Diana Krall - Love Scenes

.wav extracted with EAC

Neither DTSParser OR besplit produce .dts that is playable correctly (for the purpose of this exercise I use MPC-HC 1.7.10 64-bit with internal LAV audio decoder on PC OR standalone KODI (Openelec 7) via HDMI to Onkyo receiver)
In any case the results are identical

.wav plays perfectly, converted .dts plays too fast (and jittery)

Onkyo decodes DTS in all three files.

Code: [Select]
General
Complete name                            : E:\01 - Diana Krall - All or Nothing at All.wav
Format                                   : Wave
File size                                : 47.3 MiB
Duration                                 : 4mn 41s
Overall bit rate mode                    : Constant
Overall bit rate                         : 1 411 Kbps

Audio
Format                                   : DTS
Format/Info                              : Digital Theater Systems
Mode                                     : 14
Format settings, Endianness              : Little
Codec ID                                 : 1
Duration                                 : 4mn 41s
Bit rate mode                            : Constant
Bit rate                                 : Open
Channel(s)                               : 6 channels
Channel positions                        : Front: L C R, Side: L R, LFE
Sampling rate                            : 44.1 KHz
Frame rate                               : 43.066 fps (1024 spf)
Bit depth                                : 20 bits
Compression mode                         : Lossy
Stream size                              : 47.3 MiB (100%)
===============================

General
Complete name                            : W:\01.dtsparser.dts
Format                                   : DTS
Format/Info                              : Digital Theater Systems
File size                                : 41.3 MiB
Overall bit rate mode                    : Constant

Audio
Format                                   : DTS
Format/Info                              : Digital Theater Systems
Mode                                     : 16
Format settings, Endianness              : Big
Bit rate mode                            : Constant
Bit rate                                 : Open
Channel(s)                               : 6 channels
Channel positions                        : Front: L C R, Side: L R, LFE
Sampling rate                            : 44.1 KHz
Frame rate                               : 43.066 fps (1024 spf)
Bit depth                                : 20 bits
Compression mode                         : Lossy
===============================

General
Complete name                            : W:\01.besplit.dts
Format                                   : DTS
Format/Info                              : Digital Theater Systems
File size                                : 41.3 MiB
Duration                                 : 4mn 40s
Overall bit rate mode                    : Constant
Overall bit rate                         : 1 235 Kbps

Audio
Format                                   : DTS
Format/Info                              : Digital Theater Systems
Mode                                     : 16
Format settings, Endianness              : Big
Duration                                 : 4mn 40s
Bit rate mode                            : Constant
Bit rate                                 : 1 235 Kbps
Channel(s)                               : 6 channels
Channel positions                        : Front: L C R, Side: L R, LFE
Sampling rate                            : 44.1 KHz
Frame rate                               : 43.066 fps (1024 spf)
Bit depth                                : 20 bits
Compression mode                         : Lossy
Stream size                              : 41.3 MiB (100%)

So I wonder how to actually get the raw .dts out of the wav without re-encoding
I do not particularly need it, just would like to know how to achieve it

sebus

Re: How to extract dts from dts-wav

Reply #8
As far as I know, it's a valid DTS file except it has WAV header.    And, it's 44.1kHz (unusual for DTS) and it's somehow "padded" to 1411kbps.   

So, I assume you can simply delete the WAV header (the 1st 44 bytes) with a Hex Editor, and then change the filename extension to DTS.

Quote
So I wonder how to actually get the raw .dts out of the wav without re-encoding
I do not particularly need it, just would like to know how to achieve it
I'm not sure why anyone would want a "raw" 44.1khz, 1411kbps DTS file...   Most people would want to transcode it to something else.

Re: How to extract dts from dts-wav

Reply #9
It's complex but it can be done.  I found this method works with both Dolby Digital wav and DTS wav.  The later may bare no benefit at all in file size and will be close to the original file size.

VLC:
http://www.videolan.org/vlc/#download

FFMPEG Front End:
http://corz.org/windows/software/ffe/#section-Download

FFMPEG (choose static):
https://ffmpeg.zeranoe.com/builds/

01. Open VLC
02. Under Media menu choose "Convert"
03. Click on add and choose the wav file with the DTS stream.
04. Click on "Convert/Save"
05. Click on "Edit profile" or the wrench with screwdriver.
06. Under "Encapsulation" choose "MPEG-TS"
07. Under "Video codec" check "Video" and "Keep original video track".
08. Under "Audio codec" check "Audio" and "Keep original audio track".
09. Click save.
10. Choose a destination file and use any file name you like.  It should read "filenamehere.ts"
11. Click start.
12. Open ffe.. FFMPEG frontend and choose the FFMPEG executable.
13. Drag "filenamehere.ts" into input.
14. Under video codec choose "disable video"
15. Under audio codec choose "copy"
16. Click on "do it".
17. Change extension from "filenamehere [copy].wav" to "filenamehere.dts" using "Windows Explorer" (Windows 7 and earlier) or "File Explorer" (Windows 8 and later).  Make sure you have things set so you can see the file extension.

Re: How to extract dts from dts-wav

Reply #10
In fact mux to .ts & demux to .dts (much easier with tsMuxeR 2.6.12) produces correct playable .dts

But in fact this .dts is simply original .wav without (deleted) starting 62320 bytes = F370 in hex (up to first Bitstream type 14-bit little-endian FF 1F 00 E8 Fx 07 as per wiki )

AND ending 39340 bytes = 99AC in hex (this one I have no idea how to find by hand)

So edit in HxD is much faster, just wonder if these values apply to each file (or change somehow in each extracted .dtswav)

Tkanks Chibisteven for the pointer

sebus


Re: How to extract dts from dts-wav

Reply #11
Seems than DTSParser and BeSplit fail converting the DTS 14-bit little-endian to 16-bits big-endian standard DTS with this sample.

Put a incorrect frame size (3585 bytes) in the header, than must be 3584 bytes.
Then any player skip one frame each two and play in half time (and jittery, like you say)
I never see that problem before in other dtswav.

I change the wrong headers values: 7FFE8001FC7CE002
by the correct one: 7FFE8001FC7CDFF2
with a hex editor and now play fine.

Re: How to extract dts from dts-wav

Reply #12
Technically, it shouldn't actually alter the frame headers. The header field's size is the same regardless of 14 or 16 bit packing. Go bug that author. :D

Re: How to extract dts from dts-wav

Reply #13

I change the wrong headers values: 7FFE8001FC7CE002
by the correct one: 7FFE8001FC7CDFF2
with a hex editor and now play fine.

That has to be all occurrences in the file. You are right, it does then play.
But I wonder how it is that DTSParser created file is 6 Mb smaller

43,323,392 bytes vs 49,471,488 bytes (created via .ts mux & extraction)

sebus

Re: How to extract dts from dts-wav

Reply #14
To avoid damage of speakers when a player don't recognize a dtswav, and try to play like a standard wav file, the 2 most significant bits of a word (two bytes) in a dtswav must be always 0.

Then only 14 bits of 16 contain valid data of dts bitstream.
The standar DTS created by DTS Parser have 12088 frames of 3584 bytes = 43,323,392 bytes

The dtswav need 43,323,392 bytes * 16 / 14 = 49,512.448 bytes to the same bitstream
Also there are 44 bytes of wav header and some garbage (*) between wav header and first valid DTS 14-bit little-endian header.

(*) I don't know if this garbage is a requirement to SPDIF, but I see dtswav without this than play fine.

Like a DTS 14-bit little-endian frame need 3584 * 16 / 14 = 4096 bytes
seems than tsmuxer recover only 49,471,488 / 4096 = 12078 frames
10 frames less than DTS Parser (I never recommend tsmuxer to extract audio)

BeSplit recover 12087 frames (1 frame less than DTS parser)

Re: How to extract dts from dts-wav

Reply #15
The original dtswav have 12087 frames of 4096 bytes each one, and a last incomplete frame (only 2476 bytes, it is not a termination frame).

Then seems than DTS parser copy the last frame (the 12087 and 12088 are bit-identical) but BeSplit reject the incomplete frame.
BeSplit preserve the original Transmision bitrate (1411,2 Kb/s) but DTS parser change the field to 'Open' value.
The actual bitrate of the standard DTS is 1234.8 Kb/s (the Transmision bitrate can be equal or greater than actual bitrate).

Like DTS parser and BeSplit are abandoned sofware we can't report the bug.
Also bsconvert (from AC3filter tools) have the same bug, and other issues with this sample.

Re: How to extract dts from dts-wav

Reply #16

seems than tsmuxer recover only 49,471,488 / 4096 = 12078 frames
10 frames less than DTS Parser (I never recommend tsmuxer to extract audio)

BeSplit recover 12087 frames (1 frame less than DTS parser)

So if I get your explanation (THANKS!) right, tsmuxer extract less frames, but creates more data on disk?

The original "01 - Diana Krall - All or Nothing at All.dtswav" file is 49,573,148 (49,512.448 bytes of dts stream 12088 frames (12087 full & 1 partial + wav header + wav garbage after header)

tsmuxer extracted .dts = 49,471,488 bytes (in fact it is just a big chunk of the original .dtswav byte for byte, but without the last incomplete frame)
while
dtspartser extracted .dts = 43,323,392 bytes (is completely different to the original .dtswav as it was rebuilt stream & the two bytes from .dtwav were simply removed?)

So tsmuxer creates 6 Mb MORE on the disk (as it keeps the two bytes per frame that are in dtswav, right?)

Yest both seems to play the correctly for the same duration.

sebus

Re: How to extract dts from dts-wav

Reply #17
EMPTY

Re: How to extract dts from dts-wav

Reply #18
dtspartser extracted .dts = 43,323,392 bytes (is completely different to the original .dtswav as it was rebuilt stream & the two bytes from .dtwav were simply removed?)

So tsmuxer creates 6 Mb MORE on the disk (as it keeps the two bytes per frame that are in dtswav, right?)
Yes, but the removed part is 2 bits each 2 bytes (14 valid bits in 16 bits)

Re: How to extract dts from dts-wav

Reply #19
I make a little tool to do the dtswav to standard dts conversión.

Instead read the framesize in the header, like seems a buggy data, I read the file to calculate the correct framesize.
Seems work fine with all dtswav than I have, even with the created with ffdcaenc.

Re: How to extract dts from dts-wav

Reply #20
The frame size in the header assumes that the packets are using all 16 bits of each word. It must be scaled accordingly if the stream is encoded as 14 bits per word. Times eight, divided by seven.

Re: How to extract dts from dts-wav

Reply #21
The frame size in the header assumes that the packets are using all 16 bits of each word. It must be scaled accordingly if the stream is encoded as 14 bits per word. Times eight, divided by seven.
That is like must be, but is wrong in real samples:
Code: [Select]
                                                    Sample
                                                   in thread  Others   ffdcaenc
                                                   ---------  -------  --------
FrameSize Field in header of stream (FSIZE+1)   :    3585      3600      1808
FrameSize14le real in stream (searching headers):    4096      4096      2048
FrameSize16be calculated (FrameSize14le x 7 / 8):    3584      3584      1792

We can't obtain 3585, or 3600, from 4096 bytes, we obtain only 4096 x 7 / 8 = 3584
Or 2048 x 7 / 8 = 1792 bytes, and not 1808.


Re: How to extract dts from dts-wav

Reply #22
A little necroposting.
As for 2019 it seems that simple extracting with ffmpeg works
ffmpeg.exe -i inputfile.wav -c:a copy outputfile.dts

I tried wav2dts but it is not working on my system. Is it 64 bit?

Re: How to extract dts from dts-wav

Reply #23
The frame size in the header assumes that the packets are using all 16 bits of each word. It must be scaled accordingly if the stream is encoded as 14 bits per word. Times eight, divided by seven.
It works great!
Just using CMD prompt (not poweshell) dts2wav (drop file) and hit enter.
Is there a batch encode option?

Re: How to extract dts from dts-wav

Reply #24
There are a few encoder frontends that can be customized with additional strange encoders. The one that I use is Frontah. Old, but proven and reliable. You are free to judge it by its best before date, or smell and taste it. I added DTS under (Utility -> DTS2WAV, both ways). Another WAV->DTS extractor is BeSplit.

j7n.sytes.net/apps/Frontah_0-92_beta2_updated_encoders_20210609.rar

There are indeed at least two common cases of 44.1 kHz DTS with wrong frame size or "open bitrate", that should be fixed for maximum compatibility. Players usually choke on them playing every other frame. I've never encountered this with 48 kHz movie tracks.

FF1F00E8F107E0FC980000FA -> FF1F00E8F107DFFC98FC00EC
FF1F00E8F0077FFC98FC00EC -> FF1F00E8F0076FFC98FC00EC