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: DTS decoding in foobar v2 (Read 10676 times) previous topic - next topic
0 Members and 1 Guest are viewing this topic.

Re: DTS decoding in foobar v2

Reply #25
Seems suboptimal....the truncation part, that's not best practice when going from higher bit to 16, is it?
Of course it is suboptimal and truncation isn't best practice. I'm not advocating this behavior, just telling how it is.

But again I only asked because f2K uses ffmpeg.   I'll try setting output to FLAC and see what happens. I see if doing that actually changes an ffmpeg command parameter, or just pipes the ffmpeg 16 bit output wav to a flac encoder.
As it been wrote already: behavior of fb2k's converter is not anyhow connected with default behavior of ffmpeg. Unless you are using ffmpeg.exe through "FFmpeg decoder wrapper" component to decode your files. At least in 32-bit version of fb2k, all internal decoders (including ffmpeg based ones) decode everything to 32bit floating point (maybe in 64-bit version it is 64 bit floating point, i don't know).

FWIW I've downlaoded the latest ffmpeg package with all shared libraries, for windows 64  (ffmpeg-n6.0-latest-win64-gpl-shared-6.0) and may experiment with that.  If nothing else I now have all the documentation that comes with. The internal working of the libraries is still opaque to me though.

Audiomuxer logs its conversions, so I get info from that, though not very detailed . Here's what a conversion from 5.0 DTS 96/24 file to wav logged, using default values (meaning the libDcaDec DTS decoder, which according to its github page, is deprecated due to it being now "fully integrated into FFmpeg master branch and further development will continue there. Using FFmpeg for DTS decoding is now recommended.")

Code: [Select]
==> Cross-EyedMary.dts
> DTS | 96000Hz | 1 510 kb/s | 5Ch (2/2/0.1)

> Eac3to LOG -->
eac3to v3.36
command line: "eac3to.exe"  Cross-EyedMary.dts   Cross-EyedMary.wav  -progressnumbers
------------------------------------------------------------------------------
DTS-96/24, 2/2.1 channels, 0:04:12, 1510kbps, 96kHz
Decoding with libDcaDec DTS Decoder...
Writing WAV...
Creating file ...
eac3to processing took 5 seconds.
Done.

>  Cross-EyedMary.wav created

The output file is a 96 kHz 24 bits 5 channel .wav (extensible wav format)


Specifying FLAC output adds a SOX step

Code: [Select]
==> Cross-EyedMary.dts
> DTS | 96000Hz | 1 510 kb/s | 5Ch (2/2/0.1)

> Eac3to LOG -->
eac3to v3.36
command line: "eac3to.exe" Cross-EyedMary.dts Cross-EyedMary.tmp.wav"  -progressnumbers
------------------------------------------------------------------------------
DTS-96/24, 2/2.1 channels, 0:04:12, 1510kbps, 96kHz
Decoding with libDcaDec DTS Decoder...
Writing WAV...
Creating file Cross-Eyed Mary.tmp.wav ...
eac3to processing took 5 seconds.
Done.
> Sox LOG -->
Input File     :  Cross-EyedMary.tmp.wav
Channels       : 5
Sample Rate    : 96000
Precision      : 24-bit
Sample Encoding: 24-bit Signed Integer PCM
Done.

> Cross-EyedMary.flac created

There's also an option to use the libav DTS decoder..which I guess is the ffmpeg decoder.   It does this with the same input format  and .wav out selected (interesting that there's an explicit step to deal with clipping, and that the output is the DTS 'core' decode rate of 48 kHz):
Code: [Select]
==> Cross-EyedMary.dts
> DTS | 96000Hz | 1 510 kb/s | 5Ch (2/2/0.1)

> Eac3to LOG -->
eac3to v3.36
command line: "eac3to.exe" Cross-EyedMary.dts Cross-EyedMary.wav -libav -progressnumbers
------------------------------------------------------------------------------
DTS-96/24, 2/2.1 channels, 0:04:12, 1510kbps, 96kHz
Decoding with libav/ffmpeg...
Reducing depth from 64 to 24 bits...
Writing WAV...
Creating file Cross-EyedMary.wav...
Clipping detected, a 2nd pass will be necessary.  <WARNING>
Starting 2nd pass...
Decoding with libav/ffmpeg...
Reducing depth from 64 to 24 bits...
Writing WAV...
Applying -0.1dB gain...
Creating file Cross-EyedMary.wav...
eac3to processing took 8 seconds.
Done.

> Cross-EyedMary.wav created

The output file is a 48kHz 24 bit .wav file   (extensible wav format)

specifying FLAC output produces a .flac file that decodes to the same 48/24 .wav file as above. 








 

Re: DTS decoding in foobar v2

Reply #26
ffmpeg does the same to 8-bit PCM files produced by ffmpeg, so ffmpeg would be much more buggy if you were speaking the truth. Good for ffmpeg that you don't.
https://filebin.net/5itric7h9e3qspeh contains
8bit.wav
8bit.wv created by reference WavPack - works, of course.
8bit.wav-ffmpeg-to.flac created from the .wav by ffmpeg - 16-bit file and not 8-bit file, but apart from that it contains what it should.
8bit.wav-ffmpeg-to.wv is the offending file.

But it isn't about the .wav. Converting it to .aif, to .caf (both endianness) or even to .au (using ffmpeg - attached!) and then ffmpegging over to .wv - what happens? Five identical (and corrupted) .wv files.
wvunpack.exe -v .\8bit.wav-ffmpeg-to.wv returns:
Code: [Select]
 WVUNPACK  Hybrid Lossless Audio Decompressor  Win64 Version 5.6.0
 Copyright (c) 1998 - 2022 David Bryant.  All Rights Reserved.

missing data or crc errors detected in 27 block(s)!  

Edit: and it isn't about the signal. Try ffmpegging the 8-bit.wv to .wv

Well, with latest version, ffmpeg produced  8bit .wv files pass crc check with wvunpack. It was liittle error.

Re: DTS decoding in foobar v2

Reply #27
Actually foobar2000 will create 24-bit output even for lossy sources, if the input reports such bitdepth. The sample DTS files I have all behave that way. @krabapple - if you have a DTS that is incorrectly detected, Peter could use a sample.

Re: DTS decoding in foobar v2

Reply #28
@Case , here is archive with DTS 96/24, which doesn't report any bitdepth in fb2k v2 with built-in DTS decoder - https://www.dropbox.com/s/vcn887q9j8ih7i5/wdwsdedfef.zip?dl=1  Just like any other lossy DTS that i have. I personally don't think this is incorrect.

Re: DTS decoding in foobar v2

Reply #29
The foobar2000 v2.1 preview released today recognizes DTS 96/24 as a format that is meant to produce 24 bit output.

Re: DTS decoding in foobar v2

Reply #30
If DTS "96/24" is detected as 24-bit by now, it seems not logical that DTS "High Resolution Audio" is not detected as 24-bit. Sample - https://www.dropbox.com/s/me4raecqht3r29c/DTS-HD%20High%20Resolution%20Audio.dtshd?dl=1

BTW, DTS "96/24" (and "High Resolution Audio" too) can actually be created from 16-bit source. Samples - https://www.dropbox.com/s/4dda6rj490i228d/DTS%20-%2016.zip?dl=1 Somehow Mediainfo is able to distinguish between "96/24" and "High Resolution Audio" from 24-bit and 16-bit source.

Re: DTS decoding in foobar v2

Reply #31
What MediaInfo does looks complex, I currently do not have time to reverse-engineer this. Links to relevant specifications are welcome.

It would also help if FFmpeg / FFprobe was able to return bit depth info for these files so I can just relay it. Perhaps file a bug with FFmpeg about this and see what they say.
Microsoft Windows: We can't script here, this is bat country.

 

Re: DTS decoding in foobar v2

Reply #32
Finding 96/24 or HRA made from 16-bit in the wild is highly unlikely anyway, so not really a problem.

But detectiing 96/24 as 24 bit while HRA is detected as unknown bitdepth still seems inconsistent.

Re: DTS decoding in foobar v2

Reply #33
Maybe I can get this thread of mine back on track after so many sidetracks

- I hope everyone's got the whole 8 bit audio thing out of their systems, because I couldn't care less about it.
- Yes, DTS 96/24 is lossy compared to what was fed to the DTS encoder, like all flavors of DTS except HD-Master Audio.  That is not the issue.  There's no need to discuss it.
- this is not about audibility, either

DTS 96/24 was/is a common lossy format for multichannel music on DVD-V; also frequently offered as a lossy alternative version on DVD-Audio discs. 

The issue is that the decoded output of a DTS 96/24 file should be a 96kHz 24 bit PCM file*.  Audiomuxer (freeware which uses the free dcadec decoder) correctly does this; DVD Audio Extractor (commercial software, decoder unknown) correctly does this.  But foobar2k v.2.0 (using ffmpeg) decodes the same file to 96 kHz/ 16 bit PCM.

dcadec , which bills itself as 'DTS Coherent Acoustics decoder with support for HD extensions', says it is deprecated since 2016: "This decoder has been fully integrated into FFmpeg master branch and further development will continue there. Using FFmpeg for DTS decoding is now recommended." 

This suggests to me that there is a set of options and parameters for ffmpeg that result in correct i.e., 96/24 decoded output of a DTS 96/24 file.  But I haven't figured out what they are yet.

If someone has figured that out, perhaps foobar's next iteration can offer correct decoding via ffmpeg, or barring that, incorporate dcadec as an alternate DTS decoder preference?


*if the the DTS decoder is old enough to predate DTS 96/24, then it will decode just the legacy 48kHz/24bit DTS 'core' embedded in the DTS 96/24 stream, because DTS designed such back-compatibility into the format




Re: DTS decoding in foobar v2

Reply #34
The issue is that the decoded output of a DTS 96/24 file should be a 96kHz 24 bit PCM file*.  [...] But foobar2k v.2.0 (using ffmpeg) decodes the same file to 96 kHz/ 16 bit PCM.
Sounds like you are talking about an issue that was already fixed four months ago. It was introduced in 2.1 on June 5th.

foobar2000 v2.0 is stuck working the way it does. There's no telling when the next version with stable-label is released but the 2.1 previews are better than 2.0 in all meters.

I think Peter is not keen on releasing stable builds until he's super sure of the quality. It has happened so many times that immediately after something is released as stable the big public installs it and some embarrassing bugs are found.

Re: DTS decoding in foobar v2

Reply #35
The issue is that the decoded output of a DTS 96/24 file should be a 96kHz 24 bit PCM file*.  [...] But foobar2k v.2.0 (using ffmpeg) decodes the same file to 96 kHz/ 16 bit PCM.
Sounds like you are talking about an issue that was already fixed four months ago. It was introduced in 2.1 on June 5th.


ah, excellent news! I hadn't checked the latest preview version of f2k.

[\me downloads v2.1 64bit & checks to see if it works on a multichannel 96/24 dts file] yup, it does!