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

wasapi-exclusive-buffer ? #13996

Closed
NeilTohno opened this issue Apr 26, 2024 · 5 comments
Closed

wasapi-exclusive-buffer ? #13996

NeilTohno opened this issue Apr 26, 2024 · 5 comments
Labels

Comments

@NeilTohno
Copy link

NeilTohno commented Apr 26, 2024

Important Information

Provide following Information:

--wasapi-exclusive-buffer=<default|min|1-2000000>
Set buffer duration in exclusive mode (i.e., with --audio-exclusive=yes). default and min use the default and minimum device period reported by WASAPI, respectively. You can also directly specify the buffer duration in microseconds, in which case a duration shorter than the minimum device period will be rounded up to the minimum period.

The default buffer duration should provide robust playback in most cases, but reportedly on some devices there are glitches following stream resets under the default setting. In such cases, specifying a shorter duration might help.

https://mpv.io/manual/master/#audio-output-drivers-wasapi-exclusive-buffer

I set wasapi-exclusive-buffer=5 (ms), and I found that the result is 5 us,
Thanks.

mpv.exe --ao=wasapi --audio-exclusive=yes --wasapi-exclusive-buffer=5 --log-file="Y:/mpv.log" "Y:\TT3\02.mkv"

Log file

[   0.610][d][ao/wasapi] IAudioClient::GetDevicePeriod
[   0.610][v][ao/wasapi] Device period: default 10000 us, minimum 3000 us
[   0.610][v][ao/wasapi] Requested buffer duration: 5 us
[   0.610][v][ao/wasapi] Trying buffer duration 3000 us
[   0.610][d][ao/wasapi] IAudioClient::Initialize
[   0.642][d][ao/wasapi] IAudioClient::Initialize pRenderClient
[   0.642][d][ao/wasapi] IAudioClient::Initialize IAudioClient_SetEventHandle
[   0.642][d][ao/wasapi] IAudioClient::Initialize IAudioClient_GetBufferSize
[   0.642][v][ao/wasapi] Buffer frame count: 144 (3000 us)
[   0.642][v][ao/wasapi] IAudioClock::GetFrequency gave a frequency of 48000.
[   0.643][d][ao/wasapi] Activating pEndpointVolume interface
[   0.644][d][ao/wasapi] IAudioEndpointVolume::QueryHardwareSupport
[   0.644][d][ao/wasapi] Entering dispatch loop
[   0.644][d][ao/wasapi] Init wasapi done
[   0.644][v][ao/wasapi] device buffer: 144 samples.
[   0.644][v][ao/wasapi] using soft-buffer of 9600 samples.

log.zip

And, who can tell me which value is most suitable? I prefer large buffers.
Thank you.

@ruihe774
Copy link
Contributor

ruihe774 commented Apr 26, 2024

You can also directly specify the buffer duration in microseconds

"microseconds" is us. ms is "milliseconds".

@NeilTohno
Copy link
Author

You can also directly specify the buffer duration in microseconds

"microseconds" is us. ms is "milliseconds".

Thanks.

@Jules-A
Copy link

Jules-A commented Apr 26, 2024

Maybe worth including the unit prefix in the documentation?

@NeilTohno

This comment was marked as off-topic.

@ruihe774
Copy link
Contributor

I added the following code to the config file, will this cause any problems?

# Audio #

ad-lavc-threads=12
ao=wasapi
audio-exclusive=yes
wasapi-exclusive-buffer=6000 #min

audio-format=float
audio-channels=stereo
audio-swresample-o=resampler=soxr,precision=33
audio-swresample-o-append=cheby=1
audio-swresample-o-append=cutoff=1.00
audio-swresample-o-append=osf=fltp

# fix bgm too loud and speech too quiet
#af=lavfi="loudnorm=I=-16:TP=-3:LRA=4"
af=lavfi="loudnorm=I=-17:TP=-1:LRA=11"

It's not related to the issue; you can convert this issue to a disscussion.

@kasper93 kasper93 closed this as not planned Won't fix, can't repro, duplicate, stale Apr 26, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

4 participants