gkv311 / sview

Stereoscopic media player
GNU General Public License v3.0
97 stars 35 forks source link

"OpenAL HRTF mixing: Unsupported format" - Fixed in OpenAL Soft #115

Open ThreeDeeJay opened 2 years ago

ThreeDeeJay commented 2 years ago

Current release (22.01_16 and test build 22.05_25) uses OpenAL Soft 1.18.2 (from 2017) and it fails to render audio in HRTF and instead reports "Unsupported format" so it just uses regular stereo panning:

IMAGE ALT TEXT

However, if you replace OpenAL32.dll with the latest OpenAL Soft DLL, HRTF works and ambisonics is even spatialized following orientation (or headtracking in VR) *Click to play video IMAGE ALT TEXT

Even surround sound gets virtualized properly for headphones when HRTF is on. So perhaps the next release could include the updated DLL if everything else works fine too 👀

gkv311 commented 2 years ago

Thanks for noticing. Clearly need to work on updating third parties within the next release...

image

ThreeDeeJay commented 2 years ago

Yeah, I remember it worked at some point without having to update so I'm not sure what changed/broke, at least on my end. 😅 I think older OpenAL Soft builds were less consistent when enabling HRTF, especially when the playback device was set to certain speaker configurations. 🤔

gkv311 commented 1 year ago

@ThreeDeeJay , could you please check if newer sView build with OpenAL soft 1.23.0 makes any difference on your system?

ThreeDeeJay commented 1 year ago

Hmm, this is odd. now instead of no HRTF there's just no audio at all, though only with the file that uses an ambisonics tracks, not sure if that's the specific cause, though. This file with a stereo track does output audio: https://i.imgur.com/sHpcBbJ.mp4

gkv311 commented 1 year ago

Thanks for sharing file that is detected as Ambisonic one - I've been unable to find such samples (old ones with Ambisonic sound haven't been detected as such). Will look at it later - probably I should put some new extra code for new FFmpeg audio channels interface... image

gkv311 commented 1 year ago

Hmm, this is odd. now instead of no HRTF there's just no audio at all,

I've fixed this regression (sViewSetup_v.23.02_8.exe) - now tracks detected by FFmpeg as Ambisonic should be automatically handled.

ThreeDeeJay commented 1 year ago

Neat, now both ambisonics and HRTF are active so I'll go ahead and close this issue.👍 https://i.imgur.com/AgcD45j.mp4 Though I should point out that it's behaving differently than last time: now the voice seems to be locked and there doesn't seem to be any verticality when I look up and down. And even though YouTube supports head-locked stereo on top of the 4-channel 1st Order Ambisonics and the filename says 6 channels, it's actually only 4 channels so I don't think the voice shouldn be locked in place. 🤔 Also, here's the OpenAL Soft log: alsoft_error.txt

ThreeDeeJay commented 1 year ago

Another thing I noticed: the ambisonics sound field seems to be rotated 90 degrees to the left relative to the video. Like, in this video, the sounds that should come from the direction I'm looking at (like the drums and vocals) are heard on my left: https://i.imgur.com/1sgIbFn.mp4 Not sure if these files have metadata specifying the relative rotation or if a simple 90 degree rotation by default would work with other files, but perhaps in the future you could consider implementing a way to rotate the sound field, maybe even with a channel activity heat map overlay to match sounds to visuals like this: image

gkv311 commented 1 year ago

Ok, I'll try to check - maybe new FFmpeg reorders channels in the file...

the filename says 6 channels, it's actually only 4 channels

Anyway, sView currently handles only 4-channel ambisonics mapping to OpenAL.

gkv311 commented 1 year ago

Agrrr... difficult to find some reasonable samples. Could you share the file with the drums?

On the file below, it sounds like the order of Ambisonic channels is correctly passed (though sample for some reason has broken channel order of 5.1 AAC stream): https://www.youtube.com/watch?v=yoVbl-QPe9Q

ThreeDeeJay commented 1 year ago

Here ya go and here's the youtube link, just in case. On youtube, the panning seems aligned even though it isn't in sview so I'm not sure what's causing it. Same with this video (file download). By the way, you can use JDownloader to download specific video and audio tracks, in case you need to test more files.

That said, the video you linked does seem to be aligned properly: https://i.imgur.com/Su15CZn.mp4

ThreeDeeJay commented 9 months ago

@gkv311 btw in case you didn't get the notification from https://github.com/gkv311/sview/pull/125 (this issue and solution also exist on Android), https://github.com/kcat/openal-soft/issues/824#issuecomment-1939138243 Though on Android, we also need an MHR (HRTF) file, which isn't being embedded into the library used, though a better option would be to also allow loading external MHRs and the OpenAL Soft dev suggested how to do it here: https://github.com/kcat/openal-soft/issues/824#issuecomment-1939138243

gkv311 commented 9 months ago

Thanks for investigation. Hope to have some time to look into it..

ThreeDeeJay commented 9 months ago

Cool beans. Also it'd be nice to upgrade other dependencies like ffmpeg to support newer formats like AV1 👀👌