Opened 9 months ago

Closed 9 months ago

#10547 closed defect (fixed)

osq: fix decoding of 20-bit

Reported by: ami_stuff Owned by:
Priority: normal Component: undetermined
Version: unspecified Keywords:
Cc: Blocked By:
Blocking: Reproduced by developer: no
Analyzed by developer: no

Description

./ffmpeg -i 20bit.osq -y out.wav
ffmpeg version N-111911-gc4ab17a62d Copyright (c) 2000-2023 the FFmpeg developers
  built with gcc 11 (Ubuntu 11.4.0-1ubuntu1~22.04)
  configuration: 
  libavutil      58. 19.100 / 58. 19.100
  libavcodec     60. 25.100 / 60. 25.100
  libavformat    60. 11.100 / 60. 11.100
  libavdevice    60.  2.101 / 60.  2.101
  libavfilter     9. 11.100 /  9. 11.100
  libswscale      7.  3.100 /  7.  3.100
  libswresample   4. 11.100 /  4. 11.100
[aist#0:0/osq @ 0x55d495cf02c0] Guessed Channel Layout: stereo
Input #0, osq, from '20bit.osq':
  Duration: 00:00:02.04, start: 0.000000, bitrate: 271 kb/s
  Stream #0:0: Audio: osq, 22050 Hz, 2 channels, s32p (20 bit)
Stream mapping:
  Stream #0:0 -> #0:0 (osq (native) -> pcm_s16le (native))
Press [q] to stop, [?] for help
Output #0, wav, to 'out.wav':
  Metadata:
    ISFT            : Lavf60.11.100
  Stream #0:0: Audio: pcm_s16le ([1][0][0][0] / 0x0001), 22050 Hz, 2 channels, s16, 705 kb/s
    Metadata:
      encoder         : Lavc60.25.100 pcm_s16le
[out#0/wav @ 0x55d495cf0c80] video:0kB audio:175kB subtitle:0kB other streams:0kB global headers:0kB muxing overhead: 0.043415%
size=     176kB time=00:00:02.03 bitrate= 707.7kbits/s speed= 135x 

Attachments (2)

20bit.osq (67.6 KB ) - added by ami_stuff 9 months ago.
20_bit_fixed_96k_mono.osq (1.3 MB ) - added by ami_stuff 9 months ago.

Download all attachments as: .zip

Change History (11)

by ami_stuff, 9 months ago

Attachment: 20bit.osq added

comment:1 by Elon Musk, 9 months ago

What's wrong with it?

comment:2 by ami_stuff, 9 months ago

there is a noise at the beginning in the output, I will attach better sample

by ami_stuff, 9 months ago

Attachment: 20_bit_fixed_96k_mono.osq added

comment:3 by Elon Musk, 9 months ago

Have you source wav?

comment:4 by Elon Musk, 9 months ago

The was signals its 20bit but it actually is 24 bit.

comment:5 by ami_stuff, 9 months ago

Yes, it's a bug in the reference software (20-bit files are actually 24-bit - raw output is identical), but reference software is able to decode such broken files back to wave without noise.

Not sure if it's possible to easily handle such broken "20-bit" files or just "closed->invalid".

comment:6 by Elon Musk, 9 months ago

What about 28 bit?

comment:7 by ami_stuff, 9 months ago

probably too outdated version, no 28-bit resolution output

comment:8 by Balling, 9 months ago

20-bit files are actually 24-bit - raw output is identical

Why do you think so? As an example TrueHD does not have metadata whether it is 16 bit, 24 bit or 20 bit (this todo can be removed https://github.com/FFmpeg/FFmpeg/blob/0adaa90d89114dc86dbc5704ce31ded5b6750d13/libavcodec/mlp_parse.c#L126).

FFmpeg does not support AV_SAMPLE_FMT_S20/ WAV_SAMPLE_FMT_S20 format. https://github.com/FFmpeg/FFmpeg/blob/master/libavcodec/mlpenc.c#L551

But there are actual THD files that actually are just 20 bit.

Also EDID of my TV, LG C9 shows it supports 20 bit audio. Not that Nvidia driver supports that.

comment:9 by Elon Musk, 9 months ago

Resolution: fixed
Status: newclosed
Note: See TracTickets for help on using tickets.