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

Audio skips when spatial audio is turned on and off #4920

Open
1 task
low-batt opened this issue May 8, 2024 · 3 comments
Open
1 task

Audio skips when spatial audio is turned on and off #4920

low-batt opened this issue May 8, 2024 · 3 comments

Comments

@low-batt
Copy link
Contributor

low-batt commented May 8, 2024

System and IINA version:

  • macOS 13.6.3
  • IINA 1.3.4 + libmpv 0.38.0

Expected behavior:
Turning spatial audio on and off does not result in audio skipping.

Actual behavior:
When spatial audio is turned on and off it distrupts audio. This does not occur when using the QuickTime Player.

This was reported by @ShlomoCode in this comment. I created this issue for the problem.

Checking the mpv log file shows audio was disrupted:

mpv log:
[   0.020][v][cplayer] mpv v0.38.0-181-g467c1e860a Copyright © 2000-2024 mpv/MPlayer/mplayer2 projects
[   0.020][v][cplayer]  built on May  8 2024 12:49:20
[   0.020][v][cplayer] libplacebo version: v7.349.0 (v6.338.0-129-g47ea18ef)
[   0.020][v][cplayer] FFmpeg version: n7.0
[   0.020][v][cplayer] FFmpeg library versions:
[   0.020][v][cplayer]    libavutil       59.8.100
[   0.020][v][cplayer]    libavcodec      61.3.100
[   0.020][v][cplayer]    libavformat     61.1.100
[   0.020][v][cplayer]    libswscale      8.1.100
[   0.020][v][cplayer]    libavfilter     10.1.100
[   0.020][v][cplayer]    libswresample   5.1.100
[   0.020][v][cplayer] 
[   0.020][v][cplayer] Configuration: -Dbuildtype=debug -Dlibmpv=true -Db_asneeded=false -Dc_link_args=-fuse-ld=/usr/bin/ld -Dcplayer=false
[   0.020][v][cplayer] List of enabled features: av-channel-layout avfoundation avif-muxer bsd-fstatfs build-date cocoa coreaudio cplugins darwin debug ffmpeg gl gl-cocoa glob glob-posix gpl iconv javascript jpeg jpegxl lavu-uuid lcms2 libass libavdevice libbluray libdl libplacebo luajit mac-thread-name macos-11-features macos-12-features macos-cocoa-cb macos-media-player macos-touchbar posix posix-shm rubberband rubberband-3 seek-data swift uchardet vapoursynth vector videotoolbox-gl videotoolbox-pl vk-khr-display vulkan vulkan-interop zimg zimg-st428 zlib
…
[  19.870][w][ao/avfoundation] restarting due to system notification; this will cause desync
[  19.870][v][ao/avfoundation] notification name: AVSampleBufferAudioRendererWasFlushedAutomaticallyNotification
[  19.871][w][cplayer] 
[  19.871][w][cplayer] Audio/Video desynchronisation detected! Possible reasons include too slow
[  19.871][w][cplayer] hardware, temporary CPU spikes, broken drivers, and broken files. Audio
[  19.871][w][cplayer] position will not match to the video (see A-V status field).
[  19.871][w][cplayer] Consider trying `--profile=fast` and/or `--hwdec=auto-safe` as they may help.
[  19.871][w][cplayer] 
[  22.816][w][ao/avfoundation] restarting due to system notification; this will cause desync
[  22.816][v][ao/avfoundation] notification name: AVSampleBufferAudioRendererWasFlushedAutomaticallyNotification
[  25.631][w][ao/avfoundation] restarting due to system notification; this will cause desync
[  25.631][v][ao/avfoundation] notification name: AVSampleBufferAudioRendererWasFlushedAutomaticallyNotification
[  28.682][w][ao/avfoundation] restarting due to system notification; this will cause desync
[  28.682][v][ao/avfoundation] notification name: AVSampleBufferAudioRendererWasFlushedAutomaticallyNotification

Steps to reproduce:

  • MPV does not have this problem.

I built mpv from master at commit d6803c45183b18637e603eb1997c4ffbcc434616. Playing the above YouTube video and changing the spatial audio settings reproduced the problem with mpv as well:

[  16.179][w][ao/avfoundation] restarting due to system notification; this will cause desync
[  16.179][v][ao/avfoundation] notification name: AVSampleBufferAudioRendererWasFlushedAutomaticallyNotification
[  16.180][w][cplayer] 
[  16.180][w][cplayer] Audio/Video desynchronisation detected! Possible reasons include too slow
[  16.180][w][cplayer] hardware, temporary CPU spikes, broken drivers, and broken files. Audio
[  16.180][w][cplayer] position will not match to the video (see A-V status field).
[  16.180][w][cplayer] Consider trying `--profile=fast` and/or `--hwdec=auto-safe` as they may help.
[  16.180][w][cplayer] 

How often does this happen?
Every time.

@low-batt
Copy link
Contributor Author

low-batt commented May 8, 2024

QuickTime refused to play the YouTube video used above. Instead I tested QuickTime playing Advanced stream
H.264/HEVC/UHD/Dolby Vision/Dolby Digital/Dolby Atmos
. With QuickTime I am hearing audio disruption when toggling spatial audio settings.

I'm thinking this is AVFoundation behavior. If the behavior can be improved it would be up to Apple to address it.

@ShlomoCode
Copy link

ShlomoCode commented May 8, 2024

QuickTime refused to play the YouTube video used above.

Weird, try this (downloaded using 4K Video Downloader+)

Making.Apple.Vision.Pro.mp4

With QuickTime I am hearing audio disruption when toggling spatial audio settings.

I'm not complaining about the short disconnection in the audio, it also happens with QuickTime.
I'm talking about the fact that QuickTime takes care of compensating for the interruption and goes back a little, while IINA simply loses that second (of the audio interruption) and you have to rewind manually.
This is especially noticeable when listening to speech (lectures, etc.).

@low-batt
Copy link
Contributor Author

low-batt commented May 9, 2024

Ah. I did not understand the issue. I will take a closer look at this when I get a chance. Juggling multiple problems…

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants
@ShlomoCode @low-batt and others