[FFmpeg-user] How to convert music into DTS encoded WAV file?

Peter White peter.white at posteo.net
Wed Aug 10 21:49:30 EEST 2016


10.08.2016 20:05, Moritz Barsnick:
> On Wed, Aug 10, 2016 at 19:31:28 +0200, Peter White wrote:
>> That does not make much sense, since the final file is supposed to be
>> fltp, which is 32 bit, anyway.
>
> This may be a misconception. I believe the "fltp" ffmpeg prints for its
> inputs is the format the decoder presents. I didn't find any indication
> that DTS encodes with floating point. Actually, it should be 14 or 16
> bits, or up to 24 for DTS-HD. That certain "other tool" identified
> these as 20 bit, which leads me to believe it's DTS-HD.

Which "certain other tool"? Is it forbidden to name it here? I would
like such a tool very much. ;)

> I'm not sure
> about the state of things, but in 2013, ffmpeg only decoded the core of
> DTS-HD.

Nowadays DTS-HD lossless decoding is working. Found out while compiling
mpv the other day. But it is fairly recent. It used to be one needed
libdca for that. But the mpv devs said that it was incorporated in
ffmpeg. In fact, I do a lot of DTS-HD decoding with it.

>> But another thing popped into my head. Since it is a 6-channel audio,
>> the bitrate should be more than 1411k. This looks an awful lot like a
>> stereo bitrate, which would actually be 1411.2k (16*44.1k*2).
>
> It's compressed, and standard DTS is lossy. Your calculation is only
> valid for uncompressed PCM.

Well, then I call bullshit on the bitrate value presented there. It is
virtually impossible to hit the exact bitrate of 16-bit CD stereo that
way. But Dolby Prologic does exactly that with uncompressed PCM, IIRC.
Some fancy signal processing puts information of 6 channels into two.

>> Is it possible that this is a matrix encoding, like Dolby Prologic? I
>> don't know if it matters at all but I think it's worth pointing out,
>> just in case.
>
> If is was matrix encoded (into 2 channels), ffmpeg's demuxer would only
> show you 2 channels. Matrix decoding 2->X.1 is done in audio filters,
> IIRC.

Does ffmpeg really analyse the file or just believe the channel map it
reads? Or is there maybe some interpretation going on already, like,
ffmpeg recognizing surround matrix encoding and showing the correct
number of channels at playback.
Would make sense to me. IIRC, Dolby Prologic came to be because, there
really is only one track on a CD and the two channels are muxed in 30ms
intervals. The human ear can't tell the delay. But with 6 channels that
would be a problem, hence still 2 channels on CD but 6 at playback.
I reckon the same or similar is the case for DTS music, but to be
honest, today is the first day I read about DTS CDs.

> I'm still confused at to what this file really is. ;-)

Me, too. I just "uncompressed" it into a regular WAV:

$ ffmpeg -i test.wav test2.wav

and opened it in Audacity. It does have 6 channels then. But the
original test.wav shows as 2-channel and plays as noise. And now the
funny part. The output.wav also has 6 channels in Audacity.

$ ffmpeg -y -i test.wav -strict -2 -c:a dts output.wav

It is virtually the same size as test.wav:
$ ls -l test*.wav
  884850 Aug 10 20:26 output.wav
2654310 Aug 10 20:19 test2.wav
  886588 Aug 10 01:54 test.wav

And that size computes to 16-bit CD stereo, give or take--don't know
about overhead.

884850./5.016*8=1411244.019138756

Also, VLC thinks output.wav is MPEG Audio Layer 1/2 (mpga), which
should explain it not being able to play it as WAV.


Best,
Peter


More information about the ffmpeg-user mailing list