mpv-player / mpv

🎥 Command line video player
https://mpv.io
Other
27.75k stars 2.86k forks source link

CoreAudio_Exclusive not compatible with Interger Format & Future required on Integer Mode #3072

Open macdavis opened 8 years ago

macdavis commented 8 years ago

Firstly, I set the audio format to 24bit Integer. audio-format=s24

When the build-in audio device is selected, the exclusive mode works just fine. As indicated in the log, the ultimate format has been converted to 32bit float, which is still compatible with the build-in audio device.

[ad] Codec list: [ad] lavc:libdcadec (dts) - dcadec DCA decoder [ad] lavc:dca (dts) - DCA (DTS Coherent Acoustics) [ad] spdif:dts - libavformat/spdifenc audio pass-through decoder [ad] spdif:dts-hd (dts) - libavformat/spdifenc audio pass-through decoder [ad] Opening audio decoder lavc:libdcadec [ad] Requesting 1 threads for decoding. [ad] Selected audio codec: dcadec DCA decoder [lavc:libdcadec] [cplayer] Starting playback... [af] Adding filter lavrresample [lavrresample] Remix: 5.1(side) -> stereo [lavrresample] Remix: 5.1(side) -> stereo [af] Audio filter chain: [af] [in] 48000Hz 5.1(side) 6ch s32p [af] [lavrresample] 48000Hz stereo 2ch s24 [af] [out] 48000Hz stereo 2ch s24 [af] [ao] 48000Hz stereo 2ch s24 [ao] Trying audio driver 'coreaudio_exclusive' [ao/coreaudio_exclusive] requested format: 48000 Hz, stereo channels, s24 [ao/coreaudio_exclusive] selected audio output device: Built-in Output (50) [ao/coreaudio_exclusive] Using substream 0/1. [ao/coreaudio_exclusive] our format: 48000.0Hz 24bit mcpl [12][6bpp][1fbp][6bpf][2ch] int LE S packed (s24) [ao/coreaudio_exclusive] - 96000.0Hz 24bit mcpl [4][8bpp][1fbp][8bpf][2ch] int LE S (-) [ao/coreaudio_exclusive] - 88200.0Hz 24bit mcpl [4][8bpp][1fbp][8bpf][2ch] int LE S (-) [ao/coreaudio_exclusive] - 48000.0Hz 24bit mcpl [4][8bpp][1fbp][8bpf][2ch] int LE S (-) [ao/coreaudio_exclusive] - 44100.0Hz 24bit mcpl [4][8bpp][1fbp][8bpf][2ch] int LE S (-) [ao/coreaudio_exclusive] - 96000.0Hz 16bit mcpl [12][4bpp][1fbp][4bpf][2ch] int LE S packed (s16) [ao/coreaudio_exclusive] - 88200.0Hz 16bit mcpl [12][4bpp][1fbp][4bpf][2ch] int LE S packed (s16) [ao/coreaudio_exclusive] - 48000.0Hz 16bit mcpl [12][4bpp][1fbp][4bpf][2ch] int LE S packed (s16) [ao/coreaudio_exclusive] - 44100.0Hz 16bit mcpl [12][4bpp][1fbp][4bpf][2ch] int LE S packed (s16) [ao/coreaudio_exclusive] - 96000.0Hz 32bit mcpl [9][8bpp][1fbp][8bpf][2ch] float LE U packed (float) [ao/coreaudio_exclusive] - 88200.0Hz 32bit mcpl [9][8bpp][1fbp][8bpf][2ch] float LE U packed (float) [ao/coreaudio_exclusive] - 48000.0Hz 32bit mcpl [9][8bpp][1fbp][8bpf][2ch] float LE U packed (float) [ao/coreaudio_exclusive] - 44100.0Hz 32bit mcpl [9][8bpp][1fbp][8bpf][2ch] float LE U packed (float) [ao/coreaudio_exclusive] setting stream physical format: 48000.0Hz 24bit mcpl [4][8bpp][1fbp][8bpf][2ch] int LE S (-) [ao/coreaudio_exclusive] format in use before switching: 48000.0Hz 32bit mcpl [9][8bpp][1fbp][8bpf][2ch] float LE U packed (float) [ao/coreaudio_exclusive] actual format in use: 48000.0Hz 24bit mcpl [4][8bpp][1fbp][8bpf][2ch] int LE S (-) [ao/coreaudio_exclusive] input channel layout: [ao/coreaudio_exclusive] layout: tag: <0>, bitmap: <0>, descriptions <2> [ao/coreaudio_exclusive] - description 0: label <4294967295, 64>, flags: <0>, coords: <0.000000, 0.000000, 0.000000> [ao/coreaudio_exclusive] - description 1: label <4294967295, 64>, flags: <0>, coords: <0.000000, 0.000000, 0.000000> [ao/coreaudio_exclusive] mp chmap: unknown2 [ao/coreaudio_exclusive] input channel layout: [ao/coreaudio_exclusive] layout: tag: <0>, bitmap: <0>, descriptions <2> [ao/coreaudio_exclusive] - description 0: label <1, 0>, flags: <0>, coords: <0.000000, 0.000000, 0.000000> [ao/coreaudio_exclusive] - description 1: label <2, 1>, flags: <0>, coords: <0.000000, 0.000000, 0.000000> [ao/coreaudio_exclusive] mp chmap: stereo [ao/coreaudio_exclusive] Channel layouts: [ao/coreaudio_exclusive] - stereo [ao/coreaudio_exclusive] - mono [ao/coreaudio_exclusive] result: stereo [ao/coreaudio_exclusive] virtual format 48000.0Hz 32bit mcpl [9][8bpp][1fbp][8bpf][2ch] float LE U packed (float) [ao/coreaudio_exclusive] Latency property cntl: 430 frames [ao/coreaudio_exclusive] Latency property zisf: 512 frames [ao/coreaudio_exclusive] Latency property tfas: 144 frames [ao/coreaudio_exclusive] base latency: 22624 microseconds [ao/coreaudio_exclusive] using soft-buffer of 9600 samples. [cplayer] AO: [coreaudio_exclusive] 48000Hz stereo 2ch float [cplayer] AO: Description: CoreAudio Exclusive Mode [af] Removing filter lavrresample [af] Adding filter lavrresample [lavrresample] Remix: 5.1(side) -> stereo [lavrresample] Remix: 5.1(side) -> stereo [af] Audio filter chain: [af] [in] 48000Hz 5.1(side) 6ch s32p [af] [lavrresample] 48000Hz stereo 2ch float [af] [out] 48000Hz stereo 2ch float [af] [ao] 48000Hz stereo 2ch float

However, my external DAC (XMOS USB Audio 2.0) can only handle 24bit Integer. Therefore, the exclusive mode is no longer working. The error says “hardware format not supported”.

[ad] Codec list: [ad] lavc:libdcadec (dts) - dcadec DCA decoder [ad] lavc:dca (dts) - DCA (DTS Coherent Acoustics) [ad] spdif:dts - libavformat/spdifenc audio pass-through decoder [ad] spdif:dts-hd (dts) - libavformat/spdifenc audio pass-through decoder [ad] Opening audio decoder lavc:libdcadec [ad] Requesting 1 threads for decoding. [ad] Selected audio codec: dcadec DCA decoder [lavc:libdcadec] [cplayer] Starting playback... [af] Adding filter lavrresample [lavrresample] Remix: 5.1(side) -> stereo [lavrresample] Remix: 5.1(side) -> stereo [af] Audio filter chain: [af] [in] 48000Hz 5.1(side) 6ch s32p [af] [lavrresample] 48000Hz stereo 2ch s24 [af] [out] 48000Hz stereo 2ch s24 [af] [ao] 48000Hz stereo 2ch s24 [ao] Trying audio driver 'coreaudio_exclusive' [ao/coreaudio_exclusive] requested format: 48000 Hz, stereo channels, s24 [ao/coreaudio_exclusive] selected audio output device: XMOS USB Audio 2.0 (60) [ao/coreaudio_exclusive] Using substream 0/1. [ao/coreaudio_exclusive] our format: 48000.0Hz 24bit mcpl [12][6bpp][1fbp][6bpf][2ch] int LE S packed (s24) [ao/coreaudio_exclusive] - 192000.0Hz 24bit mcpl [4][8bpp][1fbp][8bpf][2ch] int LE S (-) [ao/coreaudio_exclusive] - 176400.0Hz 24bit mcpl [4][8bpp][1fbp][8bpf][2ch] int LE S (-) [ao/coreaudio_exclusive] - 96000.0Hz 24bit mcpl [4][8bpp][1fbp][8bpf][2ch] int LE S (-) [ao/coreaudio_exclusive] - 88200.0Hz 24bit mcpl [4][8bpp][1fbp][8bpf][2ch] int LE S (-) [ao/coreaudio_exclusive] - 48000.0Hz 24bit mcpl [4][8bpp][1fbp][8bpf][2ch] int LE S (-) [ao/coreaudio_exclusive] - 44100.0Hz 24bit mcpl [4][8bpp][1fbp][8bpf][2ch] int LE S (-) [ao/coreaudio_exclusive] - 192000.0Hz 24bit mcpl [68][8bpp][1fbp][8bpf][2ch] int LE S (-) [ao/coreaudio_exclusive] - 176400.0Hz 24bit mcpl [68][8bpp][1fbp][8bpf][2ch] int LE S (-) [ao/coreaudio_exclusive] - 96000.0Hz 24bit mcpl [68][8bpp][1fbp][8bpf][2ch] int LE S (-) [ao/coreaudio_exclusive] - 88200.0Hz 24bit mcpl [68][8bpp][1fbp][8bpf][2ch] int LE S (-) [ao/coreaudio_exclusive] - 48000.0Hz 24bit mcpl [68][8bpp][1fbp][8bpf][2ch] int LE S (-) [ao/coreaudio_exclusive] - 44100.0Hz 24bit mcpl [68][8bpp][1fbp][8bpf][2ch] int LE S (-) [ao/coreaudio_exclusive] setting stream physical format: 48000.0Hz 24bit mcpl [68][8bpp][1fbp][8bpf][2ch] int LE S (-) [ao/coreaudio_exclusive] format in use before switching: 48000.0Hz 24bit mcpl [4][8bpp][1fbp][8bpf][2ch] int LE S (-) [ao/coreaudio_exclusive] actual format in use: 48000.0Hz 24bit mcpl [4][8bpp][1fbp][8bpf][2ch] int LE S (-) [ao/coreaudio_exclusive] input channel layout: [ao/coreaudio_exclusive] layout: tag: <0>, bitmap: <0>, descriptions <2> [ao/coreaudio_exclusive] - description 0: label <1, 0>, flags: <0>, coords: <0.000000, 0.000000, 0.000000> [ao/coreaudio_exclusive] - description 1: label <2, 1>, flags: <0>, coords: <0.000000, 0.000000, 0.000000> [ao/coreaudio_exclusive] mp chmap: stereo [ao/coreaudio_exclusive] input channel layout: [ao/coreaudio_exclusive] layout: tag: <0>, bitmap: <0>, descriptions <2> [ao/coreaudio_exclusive] - description 0: label <1, 0>, flags: <0>, coords: <0.000000, 0.000000, 0.000000> [ao/coreaudio_exclusive] - description 1: label <2, 1>, flags: <0>, coords: <0.000000, 0.000000, 0.000000> [ao/coreaudio_exclusive] mp chmap: stereo [ao/coreaudio_exclusive] Channel layouts: [ao/coreaudio_exclusive] - stereo [ao/coreaudio_exclusive] - stereo [ao/coreaudio_exclusive] - mono [ao/coreaudio_exclusive] result: stereo [ao/coreaudio_exclusive] virtual format 48000.0Hz 24bit mcpl [68][8bpp][1fbp][8bpf][2ch] int LE S (-) [ao/coreaudio_exclusive] hardware format not supported [ao] Failed to initialize audio driver 'coreaudio_exclusive' [cplayer] Could not open/initialize audio device -> no sound. [ad] Uninit audio decoder. [af] Removing filter lavrresample [cplayer] Audio: no audio

While other Hi-Fi players, such as Audirvana Plus, JRiver, can work perfectly with my external DAC under the Exclusive access mode (Hog Mode). I wish that MPV can also make it. After all, the exclusive mode can achieve better sound quality.

In addition, I hope Integer Mode can also be developed as it further improves the sound quality. According to the author of Audirvana Plus, the Integer Mode has been brought back since OS X 10.9. The following link is his discussion about the Integer Mode. http://www.amr-audio.co.uk/large_image/MAC%20OSX%20audio%20players%20&%20Integer%20Mode.pdf I hope it would be helpful.

Thanks!

ghost commented 8 years ago

Since Yosemite, it's not possible to use integer formats at all. That's why mpv hardcodes float mode.

Did they change this back or are you on an older OSX version?

Audirvana uses some sort of non-public driver API to achieve integer mode, we won't do that.

ghost commented 8 years ago

In this case, I might update to el crapitan and try if this is really the case.

macdavis commented 8 years ago

Thanks for the clarification. I'm using the latest OS X, 10.11.4 (15E65).

I checked JRiver Media Centre 21.0.66 and Pure Music® Version 3.03. Both of them are working in exclusive mode.

However, in terms of Integer Mode, Pure Music is not avaliable in my laptop. JRiver says "Requires 10.9" and I don't know to way to exam whether it's successfully in Integer Mode or not.

macdavis commented 8 years ago

If we leave Integer Mode aside for now, just wondering on my external DAC, whether there is a way to achieve Exclusive Mode, just like JRiver and Pure Music does.

ghost commented 8 years ago

What do you mean by this?

macdavis commented 8 years ago

Sorry for my poor English. I mean, although Integer Mode and Exclusive Mode are related, there are two functions, right? Is there any method to achieve Exclusive Mode on my external DAC?

Just like Pure Music does. It only achieves Exclusive Mode, but not Integer Mode.

ghost commented 8 years ago

Well, in your case it seems to be failing because the driver only supports integer formats.

macdavis commented 8 years ago

Is there any code improvement can be made? I only have this issue with MPV. Exclusive Mode works on other softwares.

ghost commented 8 years ago

First I'd need El Crapitan. But I'm having problems entering fake information that Apple accepts when trying to download El Crapitan from the "app store".

macdavis commented 8 years ago

Well, anything we can do to help you overcome that issue?

ghost commented 8 years ago

I've not been able to create an apple id, so you'll have to wait for someone else to fix this.

Akemi commented 5 years ago

why? was this issue solved?

macdavis commented 5 years ago

Nah, I just opened a new issue, including some thoughts and updates. Please see, https://github.com/mpv-player/mpv/issues/6750