[FFmpeg-trac] #10540(avcodec:new): Some Meridian Lossless Packing encoded files have excess samples

FFmpeg trac at avcodec.org
Mon Aug 28 15:45:28 EEST 2023


#10540: Some Meridian Lossless Packing encoded files have excess samples
---------------------------------+----------------------------------
             Reporter:  MGislv   |                     Type:  defect
               Status:  new      |                 Priority:  normal
            Component:  avcodec  |                  Version:
             Keywords:  mlp      |               Blocked By:
             Blocking:           |  Reproduced by developer:  0
Analyzed by developer:  0        |
---------------------------------+----------------------------------
 Summary of the bug:
 While the actual audio content is lossless, excess samples get added at
 the end, causing the decoded file to have a different checksum.

 How to reproduce:
 I'm using the stable 6.0 version from Arch Linux. The sample file is
 44KHz/16bit, same happens with 48KHz/24bit.

 Attachments:
 7s-sinetone-sample.wav --> sample.wav
 7s-sinetone-sample.mlp --> sample.mlp
 Decoded-7s-sinetone-sample.wav --> D_sample.wav

 Convert sample file to mlp and decode it
 {{{
 ffmpeg started on 2023-08-28 at 14:16:57
 Report written to "ffmpeg-20230828-141657.log"
 Log level: 99
 Command line:
 ffmpeg -v 9 -loglevel 99 -report -i sample.wav -strict -2 sample.mlp
 ffmpeg version n6.0 Copyright (c) 2000-2023 the FFmpeg developers
   built with gcc 13.1.1 (GCC) 20230429
   configuration: --prefix=/usr --disable-debug --disable-static --disable-
 stripping --enable-amf --enable-avisynth --enable-cuda-llvm --enable-lto
 --enable-fontconfig --enable-gmp --enable-gnutls --enable-gpl --enable-
 ladspa --enable-libaom --enable-libass --enable-libbluray --enable-libbs2b
 --enable-libdav1d --enable-libdrm --enable-libfreetype --enable-libfribidi
 --enable-libgsm --enable-libiec61883 --enable-libjack --enable-libjxl
 --enable-libmfx --enable-libmodplug --enable-libmp3lame --enable-
 libopencore_amrnb --enable-libopencore_amrwb --enable-libopenjpeg
 --enable-libopenmpt --enable-libopus --enable-libpulse --enable-librav1e
 --enable-librsvg --enable-libsoxr --enable-libspeex --enable-libsrt
 --enable-libssh --enable-libsvtav1 --enable-libtheora --enable-libv4l2
 --enable-libvidstab --enable-libvmaf --enable-libvorbis --enable-libvpx
 --enable-libwebp --enable-libx264 --enable-libx265 --enable-libxcb
 --enable-libxml2 --enable-libxvid --enable-libzimg --enable-nvdec
 --enable-nvenc --enable-opencl --enab  libavutil      58.  2.100 / 58.
 2.100
   libavcodec     60.  3.100 / 60.  3.100
   libavformat    60.  3.100 / 60.  3.100
   libavdevice    60.  1.100 / 60.  1.100
   libavfilter     9.  3.100 /  9.  3.100
   libswscale      7.  1.100 /  7.  1.100
   libswresample   4. 10.100 /  4. 10.100
   libpostproc    57.  1.100 / 57.  1.100
 Splitting the commandline.
 Reading option '-v' ... matched as option 'v' (set logging level) with
 argument '9'.
 Reading option '-loglevel' ... matched as option 'loglevel' (set logging
 level) with argument '99'.
 Reading option '-report' ... matched as option 'report' (generate a
 report) with argument '1'.
 Reading option '-i' ... matched as input url with argument 'sample.wav'.
 Reading option '-strict' ...Routing option strict to both codec and muxer
 layer
  matched as AVOption 'strict' with argument '-2'.
 Reading option 'sample.mlp' ... matched as output url.
 Finished splitting the commandline.
 Parsing a group of options: global .
 Applying option v (set logging level) with argument 9.
 Applying option loglevel (set logging level) with argument 99.
 Applying option report (generate a report) with argument 1.
 Successfully parsed a group of options.
 Parsing a group of options: input url sample.wav.
 Successfully parsed a group of options.
 Opening an input file: sample.wav.
 [NULL @ 0x560fae271740] Opening 'sample.wav' for reading
 [file @ 0x560fae271d80] Setting default whitelist 'file,crypto,data'
 Probing wav score:99 size:2048
 [wav @ 0x560fae271740] Format wav probed with size=2048 and score=99
 [wav @ 0x560fae271740] Before avformat_find_stream_info() pos: 44 bytes
 read:65580 seeks:1 nb_streams:1
 [wav @ 0x560fae271740] probing stream 0 pp:32
 Probing adp score:25 size:4096
 [wav @ 0x560fae271740] Probe with size=4096, packets=2469 detected adp
 with score=25
 [wav @ 0x560fae271740] probing stream 0 pp:31
 Probing adp score:25 size:8192
 [wav @ 0x560fae271740] Probe with size=8192, packets=2470 detected adp
 with score=25
 [wav @ 0x560fae271740] probing stream 0 pp:30
 [wav @ 0x560fae271740] probing stream 0 pp:29
 Probing adp score:25 size:16384
 [wav @ 0x560fae271740] Probe with size=16384, packets=2472 detected adp
 with score=25
 [wav @ 0x560fae271740] probing stream 0 pp:28
 [wav @ 0x560fae271740] probing stream 0 pp:27
 [wav @ 0x560fae271740] probing stream 0 pp:26
 [wav @ 0x560fae271740] probing stream 0 pp:25
 Probing adp score:25 size:32768
 [wav @ 0x560fae271740] Probe with size=32768, packets=2476 detected adp
 with score=25
 [wav @ 0x560fae271740] probing stream 0 pp:24
 [wav @ 0x560fae271740] probing stream 0 pp:23
 [wav @ 0x560fae271740] probing stream 0 pp:22
 [wav @ 0x560fae271740] probing stream 0 pp:21
 [wav @ 0x560fae271740] probing stream 0 pp:20
 [wav @ 0x560fae271740] probing stream 0 pp:19
 [wav @ 0x560fae271740] probing stream 0 pp:18
 [wav @ 0x560fae271740] probing stream 0 pp:17
 Probing adp score:25 size:65536
 [wav @ 0x560fae271740] Probe with size=65536, packets=2484 detected adp
 with score=25
 [wav @ 0x560fae271740] probing stream 0 pp:16
 [wav @ 0x560fae271740] probing stream 0 pp:15
 [wav @ 0x560fae271740] probing stream 0 pp:14
 [wav @ 0x560fae271740] probing stream 0 pp:13
 [wav @ 0x560fae271740] probing stream 0 pp:12
 [wav @ 0x560fae271740] probing stream 0 pp:11
 [wav @ 0x560fae271740] probing stream 0 pp:10
 [wav @ 0x560fae271740] probing stream 0 pp:9
 [wav @ 0x560fae271740] probing stream 0 pp:8
 [wav @ 0x560fae271740] probing stream 0 pp:7
 [wav @ 0x560fae271740] probing stream 0 pp:6
 [wav @ 0x560fae271740] probing stream 0 pp:5
 [wav @ 0x560fae271740] probing stream 0 pp:4
 [wav @ 0x560fae271740] probing stream 0 pp:3
 [wav @ 0x560fae271740] probing stream 0 pp:2
 [wav @ 0x560fae271740] probing stream 0 pp:1
 Probing adp score:25 size:131072
 [wav @ 0x560fae271740] Probe with size=131072, packets=2500 detected adp
 with score=25
 [wav @ 0x560fae271740] probed stream 0
 [wav @ 0x560fae271740] parser not found for codec pcm_s16le, packets or
 times may be invalid.
 [wav @ 0x560fae271740] All info found
 [wav @ 0x560fae271740] stream 0: start_time: NOPTS duration: 7
 [wav @ 0x560fae271740] format: start_time: NOPTS duration: 7 (estimate
 from stream) bitrate=1411 kb/s
 [wav @ 0x560fae271740] After avformat_find_stream_info() pos: 204844 bytes
 read:294956 seeks:1 frames:50
 Guessed Channel Layout for Input Stream #0.0 : stereo
 Input #0, wav, from 'sample.wav':
   Duration: 00:00:07.00, bitrate: 1411 kb/s
   Stream #0:0, 50, 1/44100: Audio: pcm_s16le ([1][0][0][0] / 0x0001),
 44100 Hz, 2 channels, s16, 1411 kb/s
 Successfully opened the file.
 Parsing a group of options: output url sample.mlp.
 Successfully parsed a group of options.
 Opening an output file: sample.mlp.
 [file @ 0x560fae2c9100] Setting default whitelist 'file,crypto,data'
 Successfully opened the file.
 Stream mapping:
   Stream #0:0 -> #0:0 (pcm_s16le (native) -> mlp (native))
 Press [q] to stop, [?] for help
 [aost#0:0/mlp @ 0x560fae2b4380] cur_dts is invalid [init:0 i_done:0
 finish:0] (this is harmless if it occurs once at the start per stream)
 detected 12 logical cores
 [graph_0_in_0_0 @ 0x560fae2cd500] Setting 'time_base' to value '1/44100'
 [graph_0_in_0_0 @ 0x560fae2cd500] Setting 'sample_rate' to value '44100'
 [graph_0_in_0_0 @ 0x560fae2cd500] Setting 'sample_fmt' to value 's16'
 [graph_0_in_0_0 @ 0x560fae2cd500] Setting 'channel_layout' to value
 'stereo'
 [graph_0_in_0_0 @ 0x560fae2cd500] tb:1/44100 samplefmt:s16
 samplerate:44100 chlayout:stereo
 [format_out_0_0 @ 0x560fae2cdb40] Setting 'sample_fmts' to value 's16|s32'
 [format_out_0_0 @ 0x560fae2cdb40] Setting 'sample_rates' to value
 '44100|48000|88200|96000|176400|192000'
 [format_out_0_0 @ 0x560fae2cdb40] Setting 'channel_layouts' to value
 'mono|stereo|3.0(back)|quad|2.1|3.0|4.0|5.0|3.1|4.1|5.1'
 [AVFilterGraph @ 0x560fae2cb240] query_formats: 4 queried, 9 merged, 0
 already done, 0 delayed
 Output #0, mlp, to 'sample.mlp':
   Metadata:
     encoder         : Lavf60.3.100
   Stream #0:0, 0, 1/44100: Audio: mlp, 44100 Hz, stereo, s16, 128 kb/s
     Metadata:
       encoder         : Lavc60.3.100 mlp
 size=       0kB time=00:00:00.00 bitrate=   0.0kbits/s speed=N/A
 EOF in input file 0
 Terminating demuxer thread 0
 [out_0_0 @ 0x560fae2cd9c0] EOF on sink link out_0_0:default.
 No more output streams to write to, finishing.
 [out#0/mlp @ 0x560fae2ada80] All streams finished
 [out#0/mlp @ 0x560fae2ada80] Terminating muxer thread
 [AVIOContext @ 0x560fae2c9240] Statistics: 400660 bytes written, 0 seeks,
 2 writeouts
 size=     391kB time=00:00:06.99 bitrate= 457.9kbits/s speed= 279x
 video:0kB audio:391kB subtitle:0kB other streams:0kB global headers:0kB
 muxing overhead: 0.000000%
 Input file #0 (sample.wav):
   Input stream #0:0 (audio): 302 packets read (1234800 bytes); 302 frames
 decoded (308700 samples);
   Total: 302 packets (1234800 bytes) demuxed
 Output file #0 (sample.mlp):
   Output stream #0:0 (audio): 7718 frames encoded (308700 samples); 7718
 packets muxed (400660 bytes);
   Total: 7718 packets (400660 bytes) muxed
 302 frames successfully decoded, 0 decoding errors
 [AVIOContext @ 0x560fae279ec0] Statistics: 1300380 bytes read, 1 seeks
 }}}
 Decode:
 {{{
 ffmpeg started on 2023-08-28 at 14:20:55
 Report written to "ffmpeg-20230828-142055.log"
 Log level: 99
 Command line:
 ffmpeg -v 9 -loglevel 99 -report -i sample.mlp -strict -2 D_sample.wav
 ffmpeg version n6.0 Copyright (c) 2000-2023 the FFmpeg developers
   built with gcc 13.1.1 (GCC) 20230429
   configuration: --prefix=/usr --disable-debug --disable-static --disable-
 stripping --enable-amf --enable-avisynth --enable-cuda-llvm --enable-lto
 --enable-fontconfig --enable-gmp --enable-gnutls --enable-gpl --enable-
 ladspa --enable-libaom --enable-libass --enable-libbluray --enable-libbs2b
 --enable-libdav1d --enable-libdrm --enable-libfreetype --enable-libfribidi
 --enable-libgsm --enable-libiec61883 --enable-libjack --enable-libjxl
 --enable-libmfx --enable-libmodplug --enable-libmp3lame --enable-
 libopencore_amrnb --enable-libopencore_amrwb --enable-libopenjpeg
 --enable-libopenmpt --enable-libopus --enable-libpulse --enable-librav1e
 --enable-librsvg --enable-libsoxr --enable-libspeex --enable-libsrt
 --enable-libssh --enable-libsvtav1 --enable-libtheora --enable-libv4l2
 --enable-libvidstab --enable-libvmaf --enable-libvorbis --enable-libvpx
 --enable-libwebp --enable-libx264 --enable-libx265 --enable-libxcb
 --enable-libxml2 --enable-libxvid --enable-libzimg --enable-nvdec
 --enable-nvenc --enable-opencl --enab  libavutil      58.  2.100 / 58.
 2.100
   libavcodec     60.  3.100 / 60.  3.100
   libavformat    60.  3.100 / 60.  3.100
   libavdevice    60.  1.100 / 60.  1.100
   libavfilter     9.  3.100 /  9.  3.100
   libswscale      7.  1.100 /  7.  1.100
   libswresample   4. 10.100 /  4. 10.100
   libpostproc    57.  1.100 / 57.  1.100
 Splitting the commandline.
 Reading option '-v' ... matched as option 'v' (set logging level) with
 argument '9'.
 Reading option '-loglevel' ... matched as option 'loglevel' (set logging
 level) with argument '99'.
 Reading option '-report' ... matched as option 'report' (generate a
 report) with argument '1'.
 Reading option '-i' ... matched as input url with argument 'sample.mlp'.
 Reading option '-strict' ...Routing option strict to both codec and muxer
 layer
  matched as AVOption 'strict' with argument '-2'.
 Reading option 'D_sample.wav' ... matched as output url.
 Finished splitting the commandline.
 Parsing a group of options: global .
 Applying option v (set logging level) with argument 9.
 Applying option loglevel (set logging level) with argument 99.
 Applying option report (generate a report) with argument 1.
 Successfully parsed a group of options.
 Parsing a group of options: input url sample.mlp.
 Successfully parsed a group of options.
 Opening an input file: sample.mlp.
 [NULL @ 0x55f16ee49740] Opening 'sample.mlp' for reading
 [file @ 0x55f16ee49d80] Setting default whitelist 'file,crypto,data'
 Probing mlp score:100 size:65536
 [mlp @ 0x55f16ee49740] Format mlp probed with size=65536 and score=100
 [mlp @ 0x55f16ee49740] Before avformat_find_stream_info() pos: 0 bytes
 read:65536 seeks:0 nb_streams:1
 [mlp @ 0x55f16ee49740] All info found
 [mlp @ 0x55f16ee49740] stream 0: start_time: 0 duration: NOPTS
 [mlp @ 0x55f16ee49740] format: start_time: 0 duration: NOPTS (estimate
 from bit rate) bitrate=0 kb/s
 [mlp @ 0x55f16ee49740] After avformat_find_stream_info() pos: 1024 bytes
 read:65536 seeks:0 frames:1
 Input #0, mlp, from 'sample.mlp':
   Duration: N/A, start: 0.000000, bitrate: N/A
   Stream #0:0, 1, 1/44100: Audio: mlp, 44100 Hz, stereo, s16
 Successfully opened the file.
 Parsing a group of options: output url D_sample.wav.
 Successfully parsed a group of options.
 Opening an output file: D_sample.wav.
 [file @ 0x55f16ee62ec0] Setting default whitelist 'file,crypto,data'
 Successfully opened the file.
 Stream mapping:
   Stream #0:0 -> #0:0 (mlp (native) -> pcm_s16le (native))
 Press [q] to stop, [?] for help
 [aost#0:0/pcm_s16le @ 0x55f16ee62680] cur_dts is invalid [init:0 i_done:0
 finish:0] (this is harmless if it occurs once at the start per stream)
 detected 12 logical cores
 [graph_0_in_0_0 @ 0x55f16ee66080] Setting 'time_base' to value '1/44100'
 [graph_0_in_0_0 @ 0x55f16ee66080] Setting 'sample_rate' to value '44100'
 [graph_0_in_0_0 @ 0x55f16ee66080] Setting 'sample_fmt' to value 's16'
 [graph_0_in_0_0 @ 0x55f16ee66080] Setting 'channel_layout' to value
 'stereo'
 [graph_0_in_0_0 @ 0x55f16ee66080] tb:1/44100 samplefmt:s16
 samplerate:44100 chlayout:stereo
 [format_out_0_0 @ 0x55f16ee66780] Setting 'sample_fmts' to value 's16'
 [AVFilterGraph @ 0x55f16ee63dc0] query_formats: 4 queried, 9 merged, 0
 already done, 0 delayed
 Output #0, wav, to 'D_sample.wav':
   Metadata:
     ISFT            : Lavf60.3.100
   Stream #0:0, 0, 1/44100: Audio: pcm_s16le ([1][0][0][0] / 0x0001), 44100
 Hz, stereo, s16, 1411 kb/s
     Metadata:
       encoder         : Lavc60.3.100 pcm_s16le
 size=       0kB time=00:00:00.00 bitrate=N/A speed=N/A
 EOF in input file 0
 Terminating demuxer thread 0
 [out_0_0 @ 0x55f16ee665c0] EOF on sink link out_0_0:default.
 No more output streams to write to, finishing.
 [out#0/wav @ 0x55f16ee51cc0] All streams finished
 [out#0/wav @ 0x55f16ee51cc0] Terminating muxer thread
 [AVIOContext @ 0x55f16ee63000] Statistics: 1234966 bytes written, 4 seeks,
 7 writeouts
 size=    1206kB time=00:00:06.99 bitrate=1411.5kbits/s speed= 179x
 video:0kB audio:1206kB subtitle:0kB other streams:0kB global headers:0kB
 muxing overhead: 0.006316%
 Input file #0 (sample.mlp):
   Input stream #0:0 (audio): 7718 packets read (400660 bytes); 7718 frames
 decoded (308720 samples);
   Total: 7718 packets (400660 bytes) demuxed
 Output file #0 (D_sample.wav):
   Output stream #0:0 (audio): 7718 frames encoded (308720 samples); 7718
 packets muxed (1234880 bytes);
   Total: 7718 packets (1234880 bytes) muxed
 7718 frames successfully decoded, 0 decoding errors
 [AVIOContext @ 0x55f16ee51ec0] Statistics: 400660 bytes read, 0 seeks
 }}}

 I then converted them to flac to compare the MD5 signature (there's
 probably an easier way but whatever). The checksum should be different as
 the decoded file differs by having 20 more samples at the end. The rest of
 the file seems unaffected.
-- 
Ticket URL: <https://trac.ffmpeg.org/ticket/10540>
FFmpeg <https://ffmpeg.org>
FFmpeg issue tracker


More information about the FFmpeg-trac mailing list