-
Notifications
You must be signed in to change notification settings - Fork 2.8k
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
wasapi Dolby THD channel confusion can we use LAV Filters #14150
Comments
Short answer: no It'd help to know how LAV supposedly would be handling this better in technical manner given that passthrough would be actual bit stream instead of decoded results, it sounds really weird if stereo channels can get flipped. LAV is also based on its own fork of FFmpeg for reading the content, not sure if it has its own SPDIF writer or it utilizes the one from its FFmpeg. |
Can ffmpeg decodes Dolby Atmos? I don't think so. IIRC ffmpeg can only decode Dolby Digital Plus. Dolby Atmos can be decoded by Dolby Digital Plus compatible decoders but some info will be lost (e.g. 7.1 -> 5.1). If you need to play Dolby Atmos as is you may need SPDIF passthru. If there is issue decoding Dolby Atmos with ffmpeg's Dolby Digital Plus decoder you may report it to ffmpeg, IMO. |
I'm talking about passthrough. Which as @jeeb pointed out is why this is a weird issue. But it is very repeatable. |
There might be multiple reasons for flaky behavior like that and at the same time impossible for us to diagnose remotely. You need to compare stream parameters and possibly data that goes out of mpv and LAV. Both project are opensource so it should be easy to debug. |
BTW can you provide your log file? |
I didn't bother because I know this is likely to be more of an ffmpeg issue. Also logs are set to debug mode but I didn't see anything about individual channels. Just stuff about the stream opening, pausing, resetting and eventually closing. |
I want to know whether WASAPI SPDIF passthru is working properly. If you are assured that it is a issue of ffmpeg, you can report it to the upstream. |
Hi Thanks |
SPDIF activated properly. Looks like an issue of ffmpeg. BTW it'd better say "Dolby Atmos with TrueHD". It's quite different from Dolby Atmos with E-AC-3. LAV Filters have special handling with TrueHD. (You can find it in its changelog.) Maybe this is the cause of different behaviors. |
I'm using a version of ffmpeg with a fix which fixes a previous "fix" which actually broke THD Atmos. I had the same issue with the previous broken ffmpeg version as well. Since the the broken ffmpeg hasn't been fixed for some time I don't hold out much hope for an issue as flakey as this. But thanks anyway :) |
If I weren't mistaken, @mitzsch should have mentioned some like that? In other words, not sure if his fork were considered a workaround or not? https://github.com/mitzsch/mpv-winbuild/releases BTW, supposedly Dolby TrueHD should have multiple flavors and therefore just wondering if only object-based Atmos tracks were affected? Or more like both channel-based and object-based formats are actually behaving the same way? |
Atmos is by definition object based. There's are two types of Atmos. When I stated Atmos in the heading I was asked to clarify which type of Atmos. This is about THD Atmos but thinking about it, it probably also applies to THD. The @mitzsch fork fixes the broken THD ffmpeg code and I am already using it. But this is a different issue which I think has been around since before the fix. But it might be worth confirming. |
https://forum.doom9.org/showthread.php?p=1817199#post1817199
https://forum.doom9.org/showthread.php?p=1817207#post1817207
LAV filters are obviously directshow filters and therefore we could only borrow the implementation, pretty much like what Kodi was doing to deal with TrueHD (i.e. Metadata-enhanced Audio Transmission or MAT) passthrough: Metadata-enhanced Audio Transmission Possible new Seamless branching Issues TrueHD Atmos Dropouts/Cutouts on Kodi 20.5 (assuming only seamless branched sources) #24944 [Audio] TrueHD rework - totally new MAT packer implementation #24984
TrueHD passthrough Test Builds - New MAT Packer implementation
Hopefully we'll find a way to get that implemented and see how it goes, many thanks. |
Thank you for listing relevant materials. They really cast light on THD Atmos passthru. Nevertheless, mpv depend solely on ffmpeg for audio stream parsing and demuxing. If the upstream does not have support on it, there is little we can do in mpv at this time. In theory, it is possible to implement a specialized parser & demuxer in |
Well there is already a fix that works > 99% of the time for THD passthrough cutouts. I do not know why it has never been incorporated into the main ffmpeg code base. The New MAT Packer implementation reminds me of the ffmpeg "fix" which broke THD which is weird. |
As for my issue, after some additional testing, it seems to be much harder to replicated in exclusive mode. I tend not to use E mode because can cause sound config issues with other non exclusive devices. But I understand a little more than I did the last time I tried it so it should be OK. |
👍 |
Okay, also peeking into this issue. Somehow I can not believe that audio channels can be swapped by the source with passthrough enabled and working (= the AVR decodes the bitstream in a nondistorted way) decoding. In my understanding of passthrough, if audio is bitstreamed and the avr decodes it fine (in my definition not mangled audio) it works as intended. However, when interrupting the stream (like fast forward, skip, rewinding) things can get hairy - but it seems the decoding device is the culprit in that case. I can reliably reproduce a very weird issue on my avr. (with mpv or lavfilters) Reinitializing the audio output after skipping also prevents this bug from happening. In my understanding and testing my BluRay player does so - after skipping audio returns slightly delayed. (= because of the reinit of the audio output) To mimic this behavior I wrote a Lua script. Other questions I have: Does the issue also arise with TrueHD (non-Atmos) files? |
Hi @mitzsch Interesting points. Did you see my last post? Using exclusive mode seems to mitigate the issue and I wasn't able to repeat the same problem. So I didn't bother to test with an mpv build without the ffmpeg fix. Also, I do wonder if using audio-stream-silence might help when not in exclusive mode? |
Well, it would help us to understand this problem and narrow it down to what may cause this. So please test:
Thanks... Edit# |
When I was younger, sometimes my teeth used to stop hurting when I arrived at the dentist surgery. Why is this relevant? Because I can't get the damn issue to happen again. I turned off exclusive mode on Windows and in mpv and it still works perfectly now. When I did try your script I don't think it worked for me. All I saw in the logs was that it was looking for resetoninit.conf. Anyway this has been interesting. If nothing else it's a reminder that Dolby THD is a problem, especially with ffmpeg. This was repeatable at the time but now it isn't. Maybe something in my PC or receiver reset once I set it to exclusive mode and now it works exclusive or not. So unless anyone has any objections I think I should close this ticket? |
Those are the patients we love. :D Joke aside.
This would also hold up with my assumption that's its not an mpv issue and probably a decoder problem.
On my end it works just fine.
Closing the issue and reopening it in case it re-appears is probably the best option. If it re-appears please also test the lua script (it should work as described above) |
I reverted the extension to .lua and ust added the script to my Scripts folder. MPV would not be asking for the .conf otherwise :) Anyway yes I will close it for now. Thanks :) |
Important Information
Latest mpv version
Windows 10
Any mpv source
Nvidia RTX GPU
Reproduction steps
Play any THD Atmos movie/file/demo, rewind and replay
Expected behavior
Sounds come out of the same channels as before.
Actual behavior
Sometimes a sound from the right channel comes out of the left channel. Sometimes this happens without rewinding. It's not consistent but I can get it to happen regularly. It's been a problem for a long time with various different mpv/ffmpeg source. I've tried to reproduce the same issue with LAV but I can't. I have changed the heading because this is likely to be an issue with THD rather than specifically with Atmos.
I just need to know if it is somehow possible to use LAV filters for audio passthough?
The text was updated successfully, but these errors were encountered: