Opened 3 months ago

Last modified 4 weeks ago

#11262 new defect

Musepack decoding is worse quality than the official mpc decoder

Reported by: ego-lay_atman-bay Owned by:
Priority: normal Component: ffmpeg
Version: 6.1.1 Keywords:
Cc: ego-lay_atman-bay Blocked By:
Blocking: Reproduced by developer: no
Analyzed by developer: no

Description (last modified by ego-lay_atman-bay)

Summary of the bug:

I am trying to transcode an mpc (musepack) file to wav, however when I transcode this mpc file to wav, I get static that is not present when decoding using the official mpc decoder, which can be found here.

How to reproduce:

% ffmpeg -i .\m_lic_eqg_eg_stomp.mpc .\m_lic_eqg_eg_stomp-ffmpeg.wav

Here's the console output

ffmpeg started on 2024-10-22 at 20:18:26
Report written to "ffmpeg-20241022-201826.log"
Log level: 99
Command line:
"C:\\Users\\USER\\AppData\\Local\\Microsoft\\WinGet\\Links\\ffmpeg.exe" -report -v 9 -loglevel 99 -i ".\\m_lic_eqg_eg_stomp.mpc" ".\\m_lic_eqg_eg_stomp-ffmpeg.wav"
ffmpeg version 6.1-full_build-www.gyan.dev Copyright (c) 2000-2023 the FFmpeg developers
  built with gcc 12.2.0 (Rev10, Built by MSYS2 project)
  configuration: --enable-gpl --enable-version3 --enable-static --pkg-config=pkgconf --disable-w32threads --disable-autodetect --enable-fontconfig --enable-iconv --enable-gnutls --enable-libxml2 --enable-gmp --enable-bzlib --enable-lzma --enable-libsnappy --enable-zlib --enable-librist --enable-libsrt --enable-libssh --enable-libzmq --enable-avisynth --enable-libbluray --enable-libcaca --enable-sdl2 --enable-libaribb24 --enable-libaribcaption --enable-libdav1d --enable-libdavs2 --enable-libuavs3d --enable-libzvbi --enable-librav1e --enable-libsvtav1 --enable-libwebp --enable-libx264 --enable-libx265 --enable-libxavs2 --enable-libxvid --enable-libaom --enable-libjxl --enable-libopenjpeg --enable-libvpx --enable-mediafoundation --enable-libass --enable-frei0r --enable-libfreetype --enable-libfribidi --enable-libharfbuzz --enable-liblensfun --enable-libvidstab --enable-libvmaf --enable-libzimg --enable-amf --enable-cuda-llvm --enable-cuvid --enable-ffnvcodec --enable-nvdec --enable-nvenc --enable-dxva2 --enable  libavutil      58. 29.100 / 58. 29.100
  libavcodec     60. 31.102 / 60. 31.102
  libavformat    60. 16.100 / 60. 16.100
  libavdevice    60.  3.100 / 60.  3.100
  libavfilter     9. 12.100 /  9. 12.100
  libswscale      7.  5.100 /  7.  5.100
  libswresample   4. 12.100 /  4. 12.100
  libpostproc    57.  3.100 / 57.  3.100
Splitting the commandline.
Reading option '-report' ... matched as option 'report' (generate a report) with argument '1'.
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 '-i' ... matched as output url with argument '.\m_lic_eqg_eg_stomp.mpc'.
Reading option '.\m_lic_eqg_eg_stomp-ffmpeg.wav' ... matched as output url.
Finished splitting the commandline.
Parsing a group of options: global .
Applying option report (generate a report) with argument 1.
Applying option v (set logging level) with argument 9.
Applying option loglevel (set logging level) with argument 99.
Successfully parsed a group of options.
Parsing a group of options: input url .\m_lic_eqg_eg_stomp.mpc.
Successfully parsed a group of options.
Opening an input file: .\m_lic_eqg_eg_stomp.mpc.
[AVFormatContext @ 00000175db2a3e40] Opening '.\m_lic_eqg_eg_stomp.mpc' for reading
[file @ 00000175db2a42c0] Setting default whitelist 'file,crypto,data'
Probing mp3 score:1 size:2048
Probing mpc8 score:100 size:2048
[mpc8 @ 00000175db2a3e40] Format mpc8 probed with size=2048 and score=100
st:0 removing common factor 256 from timebase
[mpc8 @ 00000175db2a3e40] Before avformat_find_stream_info() pos: 19 bytes read:32800 seeks:2 nb_streams:1
[mpc8 @ 00000175db2a3e40] max_analyze_duration 5000000 reached at 6912000 microseconds st:0
[mpc8 @ 00000175db2a3e40] stream 0: start_time: 0 duration: 92.16
[mpc8 @ 00000175db2a3e40] format: start_time: 0 duration: 92.16 (estimate from stream) bitrate=73 kb/s
[mpc8 @ 00000175db2a3e40] After avformat_find_stream_info() pos: 113155 bytes read:196685 seeks:4 frames:5
Input #0, mpc8, from '.\m_lic_eqg_eg_stomp.mpc':
  Duration: 00:01:32.16, start: 0.000000, bitrate: 73 kb/s
  Stream #0:0, 5, 288/125: Audio: musepack8, 32000 Hz, stereo, s16p
Successfully opened the file.
Parsing a group of options: output url .\m_lic_eqg_eg_stomp-ffmpeg.wav.
Successfully parsed a group of options.
Opening an output file: .\m_lic_eqg_eg_stomp-ffmpeg.wav.
[out#0/wav @ 00000175db2aca80] No explicit maps, mapping streams automatically...
[aost#0:0/pcm_s16le @ 00000175db29e540] Created audio stream from input stream 0:0
[file @ 00000175db2d5380] Setting default whitelist 'file,crypto,data'
Successfully opened the file.
Stream mapping:
  Stream #0:0 -> #0:0 (musepack8 (mpc8) -> pcm_s16le (native))
Press [q] to stop, [?] for help
detected 12 logical cores
[graph_0_in_0_0 @ 00000175db330600] Setting 'time_base' to value '1/32000'
[graph_0_in_0_0 @ 00000175db330600] Setting 'sample_rate' to value '32000'
[graph_0_in_0_0 @ 00000175db330600] Setting 'sample_fmt' to value 's16p'
[graph_0_in_0_0 @ 00000175db330600] Setting 'channel_layout' to value 'stereo'
[graph_0_in_0_0 @ 00000175db330600] tb:1/32000 samplefmt:s16p samplerate:32000 chlayout:stereo
[format_out_0_0 @ 00000175db330d80] Setting 'sample_fmts' to value 's16'
[format_out_0_0 @ 00000175db330d80] auto-inserting filter 'auto_aresample_0' between the filter 'Parsed_anull_0' and the filter 'format_out_0_0'
[AVFilterGraph @ 00000175db31a5c0] query_formats: 4 queried, 4 merged, 6 already done, 0 delayed
[auto_aresample_0 @ 00000175db331200] [SWR @ 00000175db331300] Using s16p internally between filters
[auto_aresample_0 @ 00000175db331200] ch:2 chl:stereo fmt:s16p r:32000Hz -> ch:2 chl:stereo fmt:s16 r:32000Hz
Output #0, wav, to '.\m_lic_eqg_eg_stomp-ffmpeg.wav':
  Metadata:
    ISFT            : Lavf60.16.100
  Stream #0:0, 0, 1/32000: Audio: pcm_s16le ([1][0][0][0] / 0x0001), 32000 Hz, stereo, s16, 1024 kb/s
    Metadata:
      encoder         : Lavc60.31.102 pcm_s16le
size=     243kB time=00:00:02.26 bitrate= 878.0kbits/s speed=N/A    
[in#0/mpc8 @ 00000175db28b180] EOF while reading input
[in#0/mpc8 @ 00000175db28b180] Terminating demuxer thread
[aist#0:0/musepack8 @ 00000175db2b6a40] Decoder thread received EOF packet
[aist#0:0/musepack8 @ 00000175db2b6a40] Decoder returned EOF, finishing
[aist#0:0/musepack8 @ 00000175db2b6a40] Terminating decoder thread
[out_0_0 @ 00000175db330c80] EOF on sink link out_0_0:default.
No more output streams to write to, finishing.
[out#0/wav @ 00000175db2aca80] All streams finished
[out#0/wav @ 00000175db2aca80] Terminating muxer thread
[AVIOContext @ 00000175db3174c0] Statistics: 11884118 bytes written, 4 seeks, 48 writeouts
[out#0/wav @ 00000175db2aca80] Output file #0 (.\m_lic_eqg_eg_stomp-ffmpeg.wav):
[out#0/wav @ 00000175db2aca80]   Output stream #0:0 (audio): 2579 frames encoded (2971008 samples); 2579 packets muxed (11884032 bytes); 
[out#0/wav @ 00000175db2aca80]   Total: 2579 packets (11884032 bytes) muxed
[out#0/wav @ 00000175db2aca80] video:0kB audio:11606kB subtitle:0kB other streams:0kB global headers:0kB muxing overhead: 0.000656%
size=   11606kB time=00:01:32.80 bitrate=1024.4kbits/s speed=1.25e+03x    
[in#0/mpc8 @ 00000175db28b180] Input file #0 (.\m_lic_eqg_eg_stomp.mpc):
[in#0/mpc8 @ 00000175db28b180]   Input stream #0:0 (audio): 41 packets read (843738 bytes); 2579 frames decoded; 0 decode errors (2971008 samples); 
[in#0/mpc8 @ 00000175db28b180]   Total: 41 packets (843738 bytes) demuxed
[AVIOContext @ 00000175db2ace00] Statistics: 909598 bytes read, 4 seeks

Due to the filesize limit, I was only able to attach samples of the outputs of both ffmpeg and the musepack decoder, but I was able to upload the full original mpc file.

Attachments (3)

m_lic_eqg_eg_stomp.mpc (824.2 KB ) - added by ego-lay_atman-bay 3 months ago.
m_lic_eqg_eg_stomp-ffmpeg-cut.wav (2.4 MB ) - added by ego-lay_atman-bay 3 months ago.
m_lic_eqg_eg_stomp-expected-output-cut.wav (1.8 MB ) - added by ego-lay_atman-bay 3 months ago.

Change History (6)

by ego-lay_atman-bay, 3 months ago

Attachment: m_lic_eqg_eg_stomp.mpc added

by ego-lay_atman-bay, 3 months ago

by ego-lay_atman-bay, 3 months ago

comment:1 by ego-lay_atman-bay, 3 months ago

Description: modified (diff)

comment:2 by compn, 4 weeks ago

the mpc and wave you uploaded sound similar. what are you using to playback the .wav file with? if you do ffmpeg -i m_lic_eqg_eg_stomp-expected-output-cut.wav file.mp3

what does file.mp3 sound like ? what i mean is, is your wav playback the issue ?

comment:3 by ego-lay_atman-bay, 4 weeks ago

The difference is that in the ffmpeg result, there is a lot of static, whereas the musepack tools (mpcdec) (expected) output doesn't have all that static.

This shouldn't be an issue with the wav files, but just in case, I'm using vlc, audacity, and pretty much any other audio player I use.

The issue is with the mpc decoding, since vlc has the same issue while playing the mpc file. However I have found that foobar2000 doesn't have all the static (it does with the ffmpeg wav result).

If you compare both wav files in audacity, you'll see they are pretty different, and the ffmpeg result has way more static.

The ffmpeg mp3 playback sounds the exact same as the wav result (at least in vlc for android).

Note: See TracTickets for help on using tickets.