mpv-player / mpv

๐ŸŽฅ Command line video player
https://mpv.io
Other
28.35k stars 2.91k forks source link

mpv plays atrac9 in Matroska as noise. #10757

Closed filler56789 closed 2 years ago

filler56789 commented 2 years ago

mpv version Platform and Version Source of the mpv binary

{{ mpv 0.34.0-501-g161bdd9359 Copyright ยฉ 2000-2022 mpv/MPlayer/mplayer2 projects built on Sun Oct 09 12:28:45 2022 FFmpeg library versions: libavutil 57.39.100 libavcodec 59.50.100 libavformat 59.34.101 libswscale 6.8.112 libavfilter 8.49.101 libswresample 4.9.100 FFmpeg version: git-2022-10-08-94644343a }}

Reproduction steps + Expected behavior + Actual behavior

mpv ACSW-01-sample.wav = plays O.K. mpv gq-acsw-01-introd.mka = outputs noise.

Log file *0.039][d][cplayer] Run command: define-section, flags=64, args=[name="input_osc", contents="", flags="default"] [ 0.039][d][cplayer] Run command: enable-section, flags=64, args=[name="input_osc", flags="allow-hide-cursor+allow-vo-dragging"] [ 0.039][d][cplayer] Run command: define-section, flags=64, args=[name="input_forced_osc", contents="", flags="force"] [ 0.039][d][cplayer] Run command: enable-section, flags=64, args=[name="input_forced_osc", flags="allow-hide-cursor+allow-vo-dragging"] [ 0.039][v][cplayer] Running hook: ytdl_hook/on_preloaded [ 0.039][v][mkv] select track 0 [ 0.040][i][cplayer] (+) Audio --aid=1 --alang=eng () (dfpwm 2ch 48000Hz) [ 0.042][v][ad] Codec list: [ 0.042][v][ad] dfpwm - DFPWM1a audio [ 0.042][v][ad] Opening decoder dfpwm [ 0.043][v][ad] Requesting 1 threads for decoding. [ 0.043][v][ad] Selected codec: dfpwm (DFPWM1a audio) [ 0.043][v][af] User filter list: [ 0.043][v][af] (empty) [ 0.043][v][cplayer] Starting playback...**

Sample files

atrac9sample.zip Sample .WAV and sample .MKA in the archive attached to this post.

filler56789 commented 2 years ago

ZaquL wrote:

FFmpeg does not support Adnroid's LDAC. Decoder is closed source, but see this: https://github.com/hegdi/libldacdec

You misunderstood what I wrote. The log file was very-clear, the preferred Matroska demuxer of mpv misdetects atrac9 as "dfpwm" and therefore it calls the wrong audio decoder.

Traneptora commented 2 years ago

What happens if you run mpv with --demuxer=lavf?

filler56789 commented 2 years ago

@thebombzen --- demuxer=lavf detects atrac9 as atrac9 ๐Ÿ™‚ I have no idea of why the default Matroska demuxer of mpv thinks atrac9 is a type of pulse-width modulation๐Ÿ˜•

Traneptora commented 2 years ago

I can reproduce this, and it's definitely a bug in the matroska demuxer. That said I'd have to investigate a bit more as I'm unfamiliar with that area of code.

Tilka commented 2 years ago

The sample file is using a "A_MS/ACM" codec ID which means the extra data contains a WAVEFORMATEX structure. In the sample, the dwFormatTag is set to WAVE_FORMAT_EXTENSIBLE (0xFFFE) so it's part of a WAVEFORMATEXTENSIBLE structure. The SubFormat is set to 47E142D2-36BA-4D8D-88FC-61654F8C836C which finally identifies ATRAC9. mpv currently only handles one unrelated GUID, see map_audio_pcm_tag() in demux/codec_tags.c.

filler56789 commented 2 years ago

Thanks. ๐Ÿ™‚ ๐Ÿ™‚ ๐Ÿ™‚ ๐Ÿ™‚ ๐Ÿ™‚