Opened 5 months ago

#10675 new enhancement

Inaccurate duration of DTS Coherent Acoustics streams

Reported by: j7n Owned by:
Priority: wish Component: ffprobe
Version: git-master Keywords: dca, DTS
Cc: j7n Blocked By:
Blocking: Reproduced by developer: no
Analyzed by developer: no

Description

Currently the duration is estimated from the Transmission Bitrate field. It comes from a table of a small number of values and usually doesn't match the actual rate. If it is set to 0b11101 'Open', no duration is reported and the stream is not seekable. Common mismatches are ~1509 vs 1536 on DVD, and 1234.8 vs 1411.2 on DTS-CD.

Since all DCA streams without a lossless extension are constant bitrate in practice, the actual bitrate could be read from the FSIZE+1 and NBLKS, possibly verifying a few packets. Often the official DTS-CD encoder writes the frame size without subtracting 1, which could be checked by seeking one byte backwards or to the first sync word.

Currently ffmpeg cannot decode broken streams with FSIZE equal to the frame size. It overreads by one and skips every other packet resulting in half the duration in the output.

t:\working\ffmpeg-git>ffmpeg -i openunpadded1235.dts openunpadded1235.wav
ffmpeg version 2023-11-20-git-e56d91f8a8-essentials_build-www.gyan.dev Copyright
 (c) 2000-2023 the FFmpeg developers

Input #0, dts, from 'openunpadded1235.dts':
  Duration: N/A, start: 0.000000, bitrate: N/A
  Stream #0:0: Audio: dts (DTS), 44100 Hz, 5.1(side), fltp
Stream mapping:
  Stream #0:0 -> #0:0 (dts (dca) -> pcm_s16le (native))
Press [q] to stop, [?] for help
Output #0, wav, to 'openunpadded1235.wav':
  Metadata:
    ISFT            : Lavf60.17.100
  Stream #0:0: Audio: pcm_s16le ([1][0][0][0] / 0x0001), 44100 Hz, 5.1(side), s1
6, 4233 kb/s
    Metadata:
      encoder         : Lavc60.33.100 pcm_s16le
[out#0/wav @ 00000000006a7100] video:0kB audio:7776kB subtitle:0kB other streams
:0kB global headers:0kB muxing overhead: 0.001281%
size=    7776kB time=00:00:15.01 bitrate=4241.8kbits/s speed= 109x
t:\working\ffmpeg-git>ffprobe shape1235.dts
ffprobe version 2023-11-20-git-e56d91f8a8-essentials_build-www.gyan.dev Copyright (c) 2007-2023 the FFmpeg developers

[dts @ 000000000047a800] Estimating duration from bitrate, this may be inaccurate
Input #0, dts, from 'shape1235.dts':
  Duration: 00:00:26.25, start: 0.000000, bitrate: 1411 kb/s
  Stream #0:0: Audio: dts (DTS), 44100 Hz, 5.1(side), fltp, 1411 kb/s
t:\working\ffmpeg-git>ffprobe apassionplay1509.dts
ffprobe version 2023-11-20-git-e56d91f8a8-essentials_build-www.gyan.dev Copyright (c) 2007-2023 the FFmpeg developers

[dts @ 000000000055a800] Estimating duration from bitrate, this may be inaccurate
Input #0, dts, from 'apassionplay1509.dts':
  Duration: 00:00:29.49, start: 0.000000, bitrate: 1536 kb/s
  Stream #0:0: Audio: dts (DTS 96/24), 96000 Hz, 5.1(side), fltp, 1536 kb/s
t:\working\ffmpeg-git>ffprobe openpadded1411.dts
ffprobe version 2023-11-20-git-e56d91f8a8-essentials_build-www.gyan.dev Copyright (c) 2007-2023 the FFmpeg developers

Input #0, dts, from 'openpadded1411.dts':
  Duration: N/A, start: 0.000000, bitrate: N/A
  Stream #0:0: Audio: dts (DTS), 44100 Hz, 5.1(side), fltp

Linked 4 samples with length of 30 seconds each.
openunpadded1235.dts 16-bit DTS-CD, open bitrate, wrong FSIZE, unknown duration.
openpadded1411.dts 14-bit DTS-CD, same as above, directly read from CD.
apassionplay1509.dts a DVD stream with the X96k extension
shape1235.dts 16-bit DTS-CD, RATE equal to 1411.2

http://j7n.sytes.net/temp/dtssample/

My 'wish' is that seeking would be faster without reading the entire CBR stream.

Change History (0)

Note: See TracTickets for help on using tickets.