Opened 15 months ago

Closed 8 months ago

#10217 closed defect (fixed)

mlp enc: broken output when input is 8-bit 44kHz

Reported by: ami_stuff Owned by:
Priority: normal Component: avcodec
Version: git-master Keywords:
Cc: Blocked By:
Blocking: Reproduced by developer: yes
Analyzed by developer: no

Description (last modified by ami_stuff)

FFmpeg's mlp/truehd encoder produces broken files when the input is 8-bit and has exactly 44100Hz.

When the input is for example 8-bit 44099Hz, this problem doesn't happen.

The encoder is still in experimental state, but this issue shouldn't be missed.

./ffmpeg -i 8_1_44100.wav -strict -2 -y out.mlp
ffmpeg version N-109867-g5247dab6b1 Copyright (c) 2000-2023 the FFmpeg developers
  built with gcc 9 (Ubuntu 9.4.0-1ubuntu1~20.04.1)
  configuration: 
  libavutil      58.  1.100 / 58.  1.100
  libavcodec     60.  2.100 / 60.  2.100
  libavformat    60.  2.100 / 60.  2.100
  libavdevice    60.  0.100 / 60.  0.100
  libavfilter     9.  1.100 /  9.  1.100
  libswscale      7.  0.100 /  7.  0.100
  libswresample   4.  9.100 /  4.  9.100
Guessed Channel Layout for Input Stream #0.0 : mono
Input #0, wav, from '8_1_44100.wav':
  Duration: 00:00:10.00, bitrate: 352 kb/s
  Stream #0:0: Audio: pcm_u8 ([1][0][0][0] / 0x0001), 44100 Hz, 1 channels, u8, 352 kb/s
Stream mapping:
  Stream #0:0 -> #0:0 (pcm_u8 (native) -> mlp (native))
Press [q] to stop, [?] for help
Output #0, mlp, to 'out.mlp':
  Metadata:
    encoder         : Lavf60.2.100
  Stream #0:0: Audio: mlp, 44100 Hz, mono, s16, 128 kb/s
    Metadata:
      encoder         : Lavc60.2.100 mlp
size=     324kB time=00:00:09.99 bitrate= 265.5kbits/s speed= 146x    
video:0kB audio:324kB subtitle:0kB other streams:0kB global headers:0kB muxing overhead: 0.000000%
./ffmpeg -i out.mlp -f null -
ffmpeg version N-109867-g5247dab6b1 Copyright (c) 2000-2023 the FFmpeg developers
  built with gcc 9 (Ubuntu 9.4.0-1ubuntu1~20.04.1)
  configuration: 
  libavutil      58.  1.100 / 58.  1.100
  libavcodec     60.  2.100 / 60.  2.100
  libavformat    60.  2.100 / 60.  2.100
  libavdevice    60.  0.100 / 60.  0.100
  libavfilter     9.  1.100 /  9.  1.100
  libswscale      7.  0.100 /  7.  0.100
  libswresample   4.  9.100 /  4.  9.100
[mlp @ 0x561a02261640] Invalid channel 10 specified as output from matrix.
Input #0, mlp, from 'out.mlp':
  Duration: N/A, start: 0.000000, bitrate: N/A
  Stream #0:0: Audio: mlp, 44100 Hz, mono, s16
Stream mapping:
  Stream #0:0 -> #0:0 (mlp (native) -> pcm_s16le (native))
Press [q] to stop, [?] for help
[mlp @ 0x561a02262680] Invalid channel 10 specified as output from matrix.
Output #0, null, to 'pipe:':
  Metadata:
    encoder         : Lavf60.2.100
  Stream #0:0: Audio: pcm_s16le, 44100 Hz, mono, s16, 705 kb/s
    Metadata:
      encoder         : Lavc60.2.100 pcm_s16le
Error while decoding stream #0:0: Invalid data found when processing input
    Last message repeated 14 times
[mlp @ 0x561a02262680] Lossless check failed - expected d1, calculated a7.
Error while decoding stream #0:0: Invalid data found when processing input
    Last message repeated 15 times
[mlp @ 0x561a02262680] Lossless check failed - expected d4, calculated 00.
Error while decoding stream #0:0: Invalid data found when processing input
    Last message repeated 15 times
[mlp @ 0x561a02262680] Lossless check failed - expected 35, calculated 00.
Error while decoding stream #0:0: Invalid data found when processing input
    Last message repeated 15 times
[mlp @ 0x561a02262680] Lossless check failed - expected dd, calculated 00.
Error while decoding stream #0:0: Invalid data found when processing input
    Last message repeated 15 times
[mlp @ 0x561a02262680] Lossless check failed - expected c0, calculated 00.
Error while decoding stream #0:0: Invalid data found when processing input
    Last message repeated 15 times
[mlp @ 0x561a02262680] Lossless check failed - expected 10, calculated 00.
[mlp @ 0x561a02262680] restart header sync incorrect (got 0x19f7)
Error while decoding stream #0:0: Invalid data found when processing input
    Last message repeated 14 times
[mlp @ 0x561a02262680] Lossless check failed - expected 3d, calculated fe.
Error while decoding stream #0:0: Invalid data found when processing input
    Last message repeated 15 times
[mlp @ 0x561a02262680] Lossless check failed - expected c6, calculated 00.
Error while decoding stream #0:0: Invalid data found when processing input
    Last message repeated 15 times
Error while decoding stream #0:0: Invalid data found when processing input
    Last message repeated 15 times
[mlp @ 0x561a02262680] Lossless check failed - expected 28, calculated 00.
Error while decoding stream #0:0: Invalid data found when processing input
    Last message repeated 15 times
[mlp @ 0x561a02262680] Lossless check failed - expected ec, calculated 00.
Error while decoding stream #0:0: Invalid data found when processing input
    Last message repeated 15 times
[mlp @ 0x561a02262680] Lossless check failed - expected eb, calculated 00.
Error while decoding stream #0:0: Invalid data found when processing input
[mlp @ 0x561a02262680] substream 0 length mismatch
Error while decoding stream #0:0: Invalid data found when processing input
[mlp @ 0x561a02262680] substream 0 length mismatch
Error while decoding stream #0:0: Invalid data found when processing input
[mlp @ 0x561a02262680] substream 0 length mismatch
Error while decoding stream #0:0: Invalid data found when processing input
[mlp @ 0x561a02262680] substream 0 length mismatch
Error while decoding stream #0:0: Invalid data found when processing input
[mlp @ 0x561a02262680] substream 0 length mismatch
Error while decoding stream #0:0: Invalid data found when processing input
[mlp @ 0x561a02262680] substream 0 length mismatch
Error while decoding stream #0:0: Invalid data found when processing input
[mlp @ 0x561a02262680] substream 0 length mismatch
Error while decoding stream #0:0: Invalid data found when processing input
[mlp @ 0x561a02262680] substream 0 length mismatch
Error while decoding stream #0:0: Invalid data found when processing input
[mlp @ 0x561a02262680] substream 0 length mismatch
Error while decoding stream #0:0: Invalid data found when processing input
[mlp @ 0x561a02262680] substream 0 length mismatch
Error while decoding stream #0:0: Invalid data found when processing input
[mlp @ 0x561a02262680] substream 0 length mismatch
Error while decoding stream #0:0: Invalid data found when processing input
[mlp @ 0x561a02262680] substream 0 length mismatch
Error while decoding stream #0:0: Invalid data found when processing input
[mlp @ 0x561a02262680] substream 0 length mismatch
Error while decoding stream #0:0: Invalid data found when processing input
[mlp @ 0x561a02262680] substream 0 length mismatch
Error while decoding stream #0:0: Invalid data found when processing input
[mlp @ 0x561a02262680] substream 0 length mismatch
Error while decoding stream #0:0: Invalid data found when processing input
[mlp @ 0x561a02262680] Lossless check failed - expected eb, calculated 00.
[mlp @ 0x561a02262680] substream 0 length mismatch
Error while decoding stream #0:0: Invalid data found when processing input
[mlp @ 0x561a02262680] substream 0 length mismatch
Error while decoding stream #0:0: Invalid data found when processing input
[mlp @ 0x561a02262680] substream 0 length mismatch
Error while decoding stream #0:0: Invalid data found when processing input
[mlp @ 0x561a02262680] substream 0 length mismatch
Error while decoding stream #0:0: Invalid data found when processing input
[mlp @ 0x561a02262680] substream 0 length mismatch
Error while decoding stream #0:0: Invalid data found when processing input
[mlp @ 0x561a02262680] substream 0 length mismatch
Error while decoding stream #0:0: Invalid data found when processing input
[mlp @ 0x561a02262680] substream 0 length mismatch
Error while decoding stream #0:0: Invalid data found when processing input
[mlp @ 0x561a02262680] substream 0 length mismatch
Error while decoding stream #0:0: Invalid data found when processing input
[mlp @ 0x561a02262680] substream 0 length mismatch
Error while decoding stream #0:0: Invalid data found when processing input
[mlp @ 0x561a02262680] substream 0 length mismatch
Error while decoding stream #0:0: Invalid data found when processing input
[mlp @ 0x561a02262680] substream 0 length mismatch
Error while decoding stream #0:0: Invalid data found when processing input
[mlp @ 0x561a02262680] substream 0 length mismatch
Error while decoding stream #0:0: Invalid data found when processing input
[mlp @ 0x561a02262680] substream 0 length mismatch
Error while decoding stream #0:0: Invalid data found when processing input
[mlp @ 0x561a02262680] substream 0 length mismatch
Error while decoding stream #0:0: Invalid data found when processing input
[mlp @ 0x561a02262680] substream 0 length mismatch
Error while decoding stream #0:0: Invalid data found when processing input
[mlp @ 0x561a02262680] substream 0 length mismatch
Error while decoding stream #0:0: Invalid data found when processing input
[mlp @ 0x561a02262680] Lossless check failed - expected e3, calculated 00.
Error while decoding stream #0:0: Invalid data found when processing input
    Last message repeated 15 times
[mlp @ 0x561a02262680] Lossless check failed - expected ec, calculated 00.
[mlp @ 0x561a02262680] restart header sync incorrect (got 0x1200)
Error while decoding stream #0:0: Invalid data found when processing input
    Last message repeated 14 times
[mlp @ 0x561a02262680] Lossless check failed - expected 63, calculated 88.
Error while decoding stream #0:0: Invalid data found when processing input
    Last message repeated 15 times
[mlp @ 0x561a02262680] Lossless check failed - expected 1e, calculated 00.
Error while decoding stream #0:0: Invalid data found when processing input
    Last message repeated 15 times
[mlp @ 0x561a02262680] Lossless check failed - expected 88, calculated 00.
Error while decoding stream #0:0: Invalid data found when processing input
size=N/A time=00:00:09.95 bitrate=N/A speed=86.7x    
video:0kB audio:2kB subtitle:0kB other streams:0kB global headers:0kB muxing overhead: unknown
Conversion failed!
./ffmpeg -i 8_1_44099_2.wav -acodec mlp -strict -2 -y out3.mlp
ffmpeg version N-109867-g5247dab6b1 Copyright (c) 2000-2023 the FFmpeg developers
  built with gcc 9 (Ubuntu 9.4.0-1ubuntu1~20.04.1)
  configuration: 
  libavutil      58.  1.100 / 58.  1.100
  libavcodec     60.  2.100 / 60.  2.100
  libavformat    60.  2.100 / 60.  2.100
  libavdevice    60.  0.100 / 60.  0.100
  libavfilter     9.  1.100 /  9.  1.100
  libswscale      7.  0.100 /  7.  0.100
  libswresample   4.  9.100 /  4.  9.100
Guessed Channel Layout for Input Stream #0.0 : mono
Input #0, wav, from '8_1_44099_2.wav':
  Metadata:
    encoder         : Lavf58.29.100
  Duration: 00:00:10.00, bitrate: 352 kb/s
  Stream #0:0: Audio: pcm_u8 ([1][0][0][0] / 0x0001), 44099 Hz, 1 channels, u8, 352 kb/s
Stream mapping:
  Stream #0:0 -> #0:0 (pcm_u8 (native) -> mlp (native))
Press [q] to stop, [?] for hel
./ffmpeg -i out3.mlp -f null -
ffmpeg version N-109867-g5247dab6b1 Copyright (c) 2000-2023 the FFmpeg developers
  built with gcc 9 (Ubuntu 9.4.0-1ubuntu1~20.04.1)
  configuration: 
  libavutil      58.  1.100 / 58.  1.100
  libavcodec     60.  2.100 / 60.  2.100
  libavformat    60.  2.100 / 60.  2.100
  libavdevice    60.  0.100 / 60.  0.100
  libavfilter     9.  1.100 /  9.  1.100
  libswscale      7.  0.100 /  7.  0.100
  libswresample   4.  9.100 /  4.  9.100
Input #0, mlp, from 'out3.mlp':
  Duration: N/A, start: 0.000000, bitrate: N/A
  Stream #0:0: Audio: mlp, 44100 Hz, mono, s16
Stream mapping:
  Stream #0:0 -> #0:0 (mlp (native) -> pcm_s16le (native))
Press [q] to stop, [?] for help
Output #0, null, to 'pipe:':
  Metadata:
    encoder         : Lavf60.2.100
  Stream #0:0: Audio: pcm_s16le, 44100 Hz, mono, s16, 705 kb/s
    Metadata:
      encoder         : Lavc60.2.100 pcm_s16le
size=N/A time=00:00:09.99 bitrate=N/A speed=93.2x     0x    
video:0kB audio:861kB subtitle:0kB other streams:0kB global headers:0kB muxing overhead: unknown

Attachments (3)

8_1_44100.wav (430.7 KB ) - added by ami_stuff 15 months ago.
8_1_44099.wav (861.4 KB ) - added by ami_stuff 15 months ago.
8_1_44099_2.wav (430.7 KB ) - added by ami_stuff 15 months ago.

Download all attachments as: .zip

Change History (12)

by ami_stuff, 15 months ago

Attachment: 8_1_44100.wav added

by ami_stuff, 15 months ago

Attachment: 8_1_44099.wav added

by ami_stuff, 15 months ago

Attachment: 8_1_44099_2.wav added

comment:1 by ami_stuff, 15 months ago

Description: modified (diff)

comment:2 by ami_stuff, 15 months ago

attached correct 8-bit 44099Hz input file, previous one was 16-bit

comment:3 by Balling, 15 months ago

example 8-bit 44099Hz

TrueHD does not support 44099 Hz. Only multiples of 44100 and 48000. Each frame is thus either 1200 or 1 102.5 samples.

And for TrueHD 8 bits do not really make sense. TrueHD is only 24 bit, always. There is no metadata to signal 8 bit or 16 bit, only 24 bit is supported. Now old MLP has some metadata...

oh and this is a bug about thd too.

Last edited 15 months ago by Balling (previous) (diff)

comment:4 by Balling, 15 months ago

I suppose what happens is that this is mono bug: 44099 Hz requires rescaling to 44100 Hz and thus the change in bitness happens, but not in the case of 44100 8 bit.

Last edited 15 months ago by Balling (previous) (diff)

comment:5 by ami_stuff, 15 months ago

Yes this ticket is about broken, undecodable output produced by ffmpeg. This shouldn't happen whatever resolution or sample rate has the input file.

comment:6 by Balling, 15 months ago

Yes, but that may be a bug in ffmpeg general scaling. If the codec says for mlp only 16 bit and 24 bit are supported and for TrueHD only 24 bit, it should scale it (losslessly add 0 in the end).

Last edited 15 months ago by Balling (previous) (diff)

in reply to:  6 ; comment:7 by Balling, 15 months ago

Oops.

Last edited 15 months ago by Balling (previous) (diff)

in reply to:  7 comment:8 by Balling, 15 months ago

Oops.

comment:9 by Elon Musk, 8 months ago

Component: undeterminedavcodec
Reproduced by developer: set
Resolution: fixed
Status: newclosed
Version: unspecifiedgit-master
Note: See TracTickets for help on using tickets.