Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Investigate support for spatial audio on Apple platforms #9252

Closed
rcombs opened this issue Sep 29, 2021 · 21 comments
Closed

Investigate support for spatial audio on Apple platforms #9252

rcombs opened this issue Sep 29, 2021 · 21 comments

Comments

@rcombs
Copy link
Contributor

rcombs commented Sep 29, 2021

This would require switching to AVSampleBufferAudioRenderer for audio playout. Might be tricky to account for the resulting latency.

@skrew
Copy link

skrew commented Nov 1, 2021

VLC added it, the patch doesn't seems to be overkill to add

https://code.videolan.org/videolan/vlc/-/merge_requests/786/diffs?commit_id=744248f5ee6e2ffa205e2282036f9450025bc80f

@richtong
Copy link

richtong commented Jan 8, 2022

please! :-)

@rcombs
Copy link
Contributor Author

rcombs commented Jan 8, 2022

Oh, it looks like we wouldn't actually need AVSampleBufferAudioRenderer; we can just call [AVAudioSessionPortDescription setSupportsMultichannelContent] when spatialAudioEnabled is set by the system.

@tmm1
Copy link
Contributor

tmm1 commented Jan 9, 2022

That VLC patch is nonsense.

setSupportsMultichannelContent should be called unconditionally.

Spatial audio only works with AVSBAR.

@linust
Copy link

linust commented Feb 2, 2022

Any other train of thoughts on the subject or is it just hopeless?

@tbodt
Copy link

tbodt commented Feb 2, 2022

Any other train of thoughts on the subject or is it just hopeless?

It sounds really easy, you could try to do it

@linust
Copy link

linust commented Feb 2, 2022

Any other train of thoughts on the subject or is it just hopeless?

It sounds really easy, you could try to do it

No need to be snarky. I'm genuinely curious if this has a reasonable feasibility or if the nature of the current architecture makes Spatial Audio support on mpv as likely as (stable) Raid5 on BTRFS. Sometimes it's just a not-bloody-likely-mate situation.

@tmm1
Copy link
Contributor

tmm1 commented Feb 2, 2022

As mentioned several times above, this is possible only if mpv adds an audio driver that uses the AVSBAR api.

@tmm1
Copy link
Contributor

tmm1 commented Feb 7, 2022

I started to write an AVSBAR driver a few years ago: https://gist.github.com/tmm1/eaf6a982f967d92516915abff6794ead

I ran into a lot of bugs though, and the mpv internals around audio have changed significantly since then.

I also found that AVSBAR is incredibly buggy. For example if you use it with AirPlay speakers it is barely usable: https://github.com/tmm1/avsbartest

@tmm1
Copy link
Contributor

tmm1 commented Feb 7, 2022

Another approach that may or may not work: feed raw audio into AVPlayer using the CAFF format (https://developer.apple.com/library/archive/documentation/MusicAudio/Reference/CAFSpec/CAF_spec/CAF_spec.html)

I spiked a driver here, but didn't have time to investigate all the strange bugs: tmm1@96460cf

@KrisCris
Copy link

One observation - when the iOS video player nPlayer is switched to Picture in Picture mode, it uses QuickTime to decode, at which the spatial audio is enabled by default (if the video supports it)
Screen Shot 2022-08-17 at 9 27 26 PM

@byGits
Copy link

byGits commented Sep 7, 2022

I hope you'll add support for Spatial Audio soon. It's the only missing piece in making MPV/IINA perfect.

@ghost
Copy link

ghost commented Oct 27, 2022

I started to write an AVSBAR driver a few years ago: https://gist.github.com/tmm1/eaf6a982f967d92516915abff6794ead

I ran into a lot of bugs though, and the mpv internals around audio have changed significantly since then.

I also found that AVSBAR is incredibly buggy. For example if you use it with AirPlay speakers it is barely usable: https://github.com/tmm1/avsbartest

@tmm1 I have used AVSBAR in my code and I think waiting for few seconds after first enqueuing when connected to AirPlay speakers is acceptable. Does it trouble much? Or are there other bugs with AVSBAR?

@tmm1
Copy link
Contributor

tmm1 commented Oct 27, 2022

I don't remember all the issues now. Some may be fixed in newer iOS, and other may not matter for your application.

@mjbaldwin
Copy link

Just wanted to +1 this, as Infuse is currently the only player that supports spatial audio (I pay for it just for that reason). I'd like to switch to IINA for its HDR support and general awesomeness, but the lack of spatial audio is holding me back.

Is the code referenced just above in KSPlayer a helpful model? The commit it references is: kingslay/KSPlayer@cf56d1c

@ArtemBernatskyy
Copy link

abandonware

@brownknightrises23
Copy link

Any update on this?

@fsafq41
Copy link

fsafq41 commented Oct 29, 2023

Any update on this? Thanks

@varenc
Copy link
Contributor

varenc commented Nov 28, 2023

@fsafq41 PR #11955 getting merged is seems key for mpv spatial audio support. Looks like it's waiting for a review by an mpv committer but not sure 🤷‍♀️

(though possibly a different approach using something like the VLC patch is enough)

@ShlomoCode
Copy link

VLC added it, the patch doesn't seems to be overkill to add

code.videolan.org/videolan/vlc/-/merge_requests/786/diffs?commit_id=744248f5ee6e2ffa205e2282036f9450025bc80f

VLC does not support Spatial Audio

@Akemi Akemi added the os:mac label Mar 16, 2024
@Akemi
Copy link
Member

Akemi commented Apr 1, 2024

added with #11955.

@Akemi Akemi closed this as completed Apr 1, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests