Log in

View Full Version : DTS-HD to flac confusion,...


Selur
26th October 2015, 06:28
Got a bit of a surprising result reencoding a DTS-HD MA Stream and just it's core to flac:

Took the 3:21min DTS HD-Master Audio Sound Check 5.1 (169MB) from http://www.demo-world.eu/download-2d-trailers/?file=dts_hd_master_audio_sound_check_5_1_lossless-DWEU.mkv
(checked with MediaInfo stream is detected as DTS MA / Core)

What I then do is:

1. extract the dts-hd stream with:
mkvextract tracks "C:\Users\Selur\Desktop\dts_hd_master_audio_sound_check_5_1_lossless-DWEU.mkv" 1:"H:\Output\mkvextract.dts"
extracted size is 51.3MB
(checked with MediaInfo stream is detected as DTS MA / Core)

2. reencoded to flac using ffmpeg as decoder, sox for filtering and flac as encoder:
ffmpeg -y -threads 8 -loglevel fatal -c:a libdcadec -i "H:\Output\mkvextract.dts" -ac 6 -ar 48000 -sample_fmt s32 -f sox - | sox --multi-threaded --ignore-length --temp "H:\Temp" --buffer 524288 -S -t sox - --endian little -b 24 -t wav - | flac -f -F --ignore-chunk-sizes -5 -o "H:\Output\reencoderAfterExtract.flac" -
result is 22.7MB

3. renamed mkvextract.dts to mkvextract.dtshd

4. extract the DTS core using tsMuxeR:
meta file content:
MUXOPT --no-pcr-on-video-pid --new-audio-pes --demux --vbr --vbv-len=500
A_DTS, "H:\Output\mkvextract.dtshd", down-to-dts
call:
tsMuxeR h:\Output\downtodts.meta h:\Output
extracted size is 36.9MB
(checked with MediaInfo stream is detected as DTS)

5. reencoded to flac using ffmpeg as decoder, sox for filtering and flac as encoder:
ffmpeg -y -threads 8 -loglevel fatal -c:a libdcadec -i "H:\Output\mkvextract.dts" -ac 6 -ar 48000 -sample_fmt s32 -f sox - | sox --multi-threaded --ignore-length --temp "H:\Temp" --buffer 524288 -S -t sox - --endian little -b 24 -t wav - | flac -f -F --ignore-chunk-sizes -5 -o "H:\Output\reencoderDTSOnly.flac" -
result is 25.4MB

How come the dts core reencode is larger than the dts-hd reencode?
I expected that the dts-hd reencode to be larger since it should contain more data.

Also, I got another sample where the reencode of the dts core and the dts-hd stream produce the same output file size, is that 'okay' or is there something off with my encoding call?


Cu Selur

tebasuna51
26th October 2015, 11:23
How come the dts core reencode is larger than the dts-hd reencode?
I expected that the dts-hd reencode to be larger since it should contain more data.
The DTS-MA not contain more data, contain exact data to recover the original bitdepth, in this case 24 bit int.

I don't know what do ffmpeg when you use -sample_fmt s32 because valid -sample_fmt are s32be or s32le. And here you must use s24le and the sox part is useless. Using s32le you only add useless 0's to samples.

The DTS-MA -core can't recover the original data, is decoded to float samples and after convert to the specified -sample_fmt.
If you select s32le and let to sox downsample to 24 bits, or select directly s24le (ffmpeg downsample) you send to flac the same amount of data but unnexact and, some times, less compresible like here.

In my test, using the same source,:

eac3to source.mkv 2: lossless.flac -dcadec
...
[a02] Original audio track: max 24 bits, average 22 bits, most common 24 bits.
...
lossless.flac (23.865.447 bytes)

eac3to source.mkv 2: core.flac -dcadec -core
...
core.flac (26.627.945 bytes) greater than lossless.flac like expected (source average bitdepth 22 bits).

Selur
26th October 2015, 17:49
I don't know what do ffmpeg when you use -sample_fmt s32 because valid -sample_fmt are s32be or s32le. And here you must use s24le and the sox part is useless. Using s32le you only add useless 0's to samples.
'ffmpeg -sample_fmts' reported here:
name depth
u8 8
s16 16
s32 32
flt 32
dbl 64
u8p 8
s16p 16
s32p 32
fltp 32
dblp 64
no s24le available, when 32 is used sox reports:
Input File : '-' (sox)
Channels : 6
Sample Rate : 48000
Precision : 32-bit
Sample Encoding: 32-bit Signed Integer PCM
If you select s32le and let to sox downsample to 24 bits, or select directly s24le (ffmpeg downsample) you send to flac the same amount of data but unnexact and, some times, less compresible like here.
would it be better to use 'flt 32' ?

Sparktank
26th October 2015, 17:59
Shouldn't this work?
-acodec pcm_s24le

Remove sox altogether.

Selur
26th October 2015, 18:58
I often use additional filtering, which is why I normally use sox.

ffmpeg -y -threads 8 -c:a libdcadec -i "H:\Output\mkvextract.dts" -ac 6 -ar 48000 -acodec pcm_s24le -f wav - | flac -f -F --ignore-chunk-sizes -5 -o "H:\Output\reencoderAfterExtract.flac" -
produces the same 22.7MB sized file

tebasuna51
26th October 2015, 19:48
..produces the same 22.7MB sized file

Of course, is not a problem, I explain you the difference before.