mpv icon indicating copy to clipboard operation
mpv copied to clipboard

Playback stutters on unpause after being paused for a while with wasapi audio

Open racer-coder opened this issue 1 year ago • 3 comments

mpv version:

mpv 1c9c2f5 Copyright © 2000-2023 mpv/MPlayer/mplayer2 projects built on Dec 10 2023 12:02:48 libplacebo version: v6.338.0-62-g52314e0-dirty FFmpeg version: N-112938-g12e25af7a FFmpeg library versions: libavutil 58.32.100 libavcodec 60.35.100 libavformat 60.18.100 libswscale 7.6.100 libavfilter 9.14.100 libswresample 4.13.100

Windows version:

Edition Windows 11 Home Version 22H2 Installed on ‎12/‎18/‎2023 OS build 22621.3007 Experience Windows Feature Experience Pack 1000.22681.1000.0

mpv binary:

0.37.0 from Shinchiro, x86_64-v3

GPU model, driver and version:

integrated graphics Radeon 780M on 7840U AMD proc

Reproduction steps

  1. Grab a video, say this one: https://download.blender.org/peach/bigbuckbunny_movies/BigBuckBunny_320x180.mp4
  2. mpv --no-config BigBuckBunny_320x180.mp4
  3. press space bar to pause
  4. Wait for 10 seconds (longer pauses make it more likely to run into the bug)
  5. press space bar to unpause

Expected behavior

on step 5, playback should be nice and smooth.

Actual behavior

on step 5, I get a frame or two, a stutter/hiccup of maybe 1/4-1/2 second, then normal playback

If instead I run mpv with --ao=openal or --ao=sdl, the problem does not reproduce. It seems to be a wasapi problem.

Log file

log.txt

Sample files

Probably any .mp4 file (or any movie) but I did test with BigBuckBunny as indicated in step 1.

racer-coder avatar Feb 02 '24 01:02 racer-coder

I cannot reproduce this issue on my system. I use wasapi by default and this would have driven me crazy had this been present on my system.

Try updating your audio drivers, it may fix your issue. For some reason Windows update does not notify you if there is a audio driver update available. You will have to search for an updated driver for your system through MS catalog using your audio HW ID.

~Raza

Raza-0007 avatar Feb 06 '24 00:02 Raza-0007

I didn't get very far doing that, I did try clicking "Update Driver" from the Driver tab in the dialog box that I found from Device Manager. It said I'm up to date for both Realtek (6.0.9567.1, 8/23/2023) and AMD (6.0.0.4) audio devices. I did just try switching from Balanced to Best Performance power mode and it made no difference. Yes this is a laptop and yes I am currently plugged into power.

I was going to bisect to figure out which version might have caused this, but the problem reproduces with 2022-08-28 from here: https://sourceforge.net/projects/mpv-player-windows/files/64bit-v3/ That sure makes it sound like it's a "me" problem.

My workaround is ok for now so I guess you can close this or deprioritize this if no one else is complaining.

racer-coder avatar Feb 06 '24 00:02 racer-coder

That sure makes it sound like it's a "me" problem.

FWIW I'm also having the same issue. The problem is each time a video is paused and resumed the audio stream is also stopped and then restarted, and it can take hundreds of milliseconds to start a stream in WASAPI. Video, on the other hand, can be resumed immediately. When mpv's A/V sync logic notices that audio is lagging behind, it will freeze the video to let it catch up (there might be a few frames already shown, hence the "stutter").

There's not really anything we can do to fix this because it is WASAPI's fault not being able to start an audio stream fast enough. At best, we could make sure no video frames are shown before audio is up and playing, but the delay will still be there, which I don't think is any real improvement.

sunpenghao avatar Feb 10 '24 13:02 sunpenghao