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

Stuttering during video playback #12699

Closed
ghost opened this issue Oct 21, 2023 · 16 comments
Closed

Stuttering during video playback #12699

ghost opened this issue Oct 21, 2023 · 16 comments
Labels

Comments

@ghost
Copy link

ghost commented Oct 21, 2023

Important Information

Provide following Information:

mpv v0.36.0-608-gae908a70 Copyright © 2000-2023 mpv/MPlayer/mplayer2 projects
 built on Oct 21 2023 01:14:57
libplacebo version: v6.338.0-38-gadc9d7f-dirty
FFmpeg version: N-112494-g393d1ee54
FFmpeg library versions:
   libavutil       58.27.100
   libavcodec      60.30.102
   libavformat     60.15.100
   libswscale      7.4.100
   libavfilter     9.11.100
   libswresample   4.11.100

Reproduction steps

  1. Launch any video with --no-config

Expected behavior

mpv is only broken on Windows 7.

Actual behavior

mpv is broken on all versions of Windows.

Log file

ihatempv.log

@ghost ghost added the os:win label Oct 21, 2023
@Isaacx123
Copy link

Isaacx123 commented Oct 21, 2023

Can reproduce as well, constant stutters when playing any video.

Command used:
mpv --no-config --log-file=mpv.log "GHOST IN THE SHELL 1.0_t02.mkv"

mpv.log

@kasper93
Copy link
Contributor

kasper93 commented Oct 21, 2023

Interesting, I don't see much issues with my local build. But with shinchiro's it is completely broken indeed. Use older build for now.

I have some local changes that likely will resolve the issue, but I will let @sfan5 decide what to do for now. Also latest nightly build contains a few changes that might be causing that, like aotmic changes, try_lock change, timer changes.

@Isaacx123
Copy link

Using the artifacts build from here and still get stutters during playback.

mpv.log

Also happens with gpu-next:

mpv.log

@CharlesMengCA
Copy link

Bug introduced between 9f14749 and 3fb4eb2

@ghost
Copy link
Author

ghost commented Oct 21, 2023

try_lock change

I can still reproduce the issue with --ao=openal (the stuttering is actually way worse than wasapi)

But it would interesting if it's build-dependent rather than an issue with the timer changes specifically.

@debugzxcv
Copy link

unable to reproduce this after revert #12662

@Jules-A
Copy link

Jules-A commented Oct 21, 2023

Oh so it wasn't just me, I went back to the previous shinchiro build which was fine. Was noticing only slightly increased frametimes (like 5%) but it was dropping frames quite often.

@Andarwinux
Copy link
Contributor

It seems to stutter only when video-sync=audio.

@sfan5
Copy link
Member

sfan5 commented Oct 21, 2023

I can't reproduce this either, try this build and check: https://github.com/mpv-player/mpv/actions/runs/6596458157#artifacts
I'm on Win10 22H2 with an AMD CPU & dGPU by the way.

If you can still reproduce it please download this ZIP and test which executables exhibit the issue.
The revisions are as follows:

I have some local changes that likely will resolve the issue, but I will let @sfan5 decide what to do for now.

Do you have an idea what could cause this? If so, what is it?

@Andarwinux
Copy link
Contributor

Stuttering is present in latest and new, but not in other bins
Win11 25977

@kasper93
Copy link
Contributor

Do you have an idea what could cause this? If so, what is it?

diff --git a/osdep/win32/pthread.c b/osdep/win32/pthread.c
index 9bc7f0057d..c9f581957e 100644
--- a/osdep/win32/pthread.c
+++ b/osdep/win32/pthread.c
@@ -119,7 +119,7 @@ int pthread_cond_timedwait(pthread_cond_t *restrict cond,
         timeout_ms = INFINITE;
     } else if (abstime->tv_sec >= ts.tv_sec) {
         int64_t msec = (abstime->tv_sec - ts.tv_sec) * INT64_C(1000) +
-            (abstime->tv_nsec - ts.tv_nsec) / INT64_C(10000000);
+            (abstime->tv_nsec - ts.tv_nsec) / INT64_C(1000000);
         if (msec > ULONG_MAX) {
             timeout_ms = INFINITE;
         } else if (msec > 0) {

@Isaacx123
Copy link

try this build and check: https://github.com/mpv-player/mpv/actions/runs/6596458157#artifacts

Still getting stutters and frames drops on that build:

mpv.log

PC Specs:

  • Ryzen 7 5800x
  • RTX 3060 Ti
  • Windows 10 21H2

The file used is a H.264 8-bit video and is being read off a NVME SSD so there shouldn't be any bottleneck.

If you can still reproduce it please download this ZIP

Stutters and frame drops:
latest.log
new.log

Running without any issues:
latest-winpthreads.log
revert.log
before.log

I hope this helps @sfan5

@sfan5 sfan5 closed this as completed in 97afea4 Oct 21, 2023
@sfan5
Copy link
Member

sfan5 commented Oct 21, 2023

@kasper93 oops.

Next time I will definitely type 1000 * 1000 into a calculator instead of doing it by hand.

@Isaacx123 should be fixed in https://github.com/mpv-player/mpv/actions/runs/6597777436 (as soon as it finishes)

@kasper93
Copy link
Contributor

kasper93 commented Oct 21, 2023

Next time I will definitely type 1000 * 1000 into a calculator instead of doing it by hand.

We should be using new handy macros added recently MP_TIME_MS_TO_NS(1), but I forgot they are merged already. Also inb4 it doesn't actually fixes the issue, because lower timeout shouldn't be that bad, but there are lot moving threads, so probably it is, because I don't see anything else wrong really.

@Isaacx123
Copy link

Can confirm the stutters and frame drops are gone on the latest zhongfly build:

mpv.log

@ghost
Copy link
Author

ghost commented Oct 22, 2023

Late to the party, but yes, the issue is fixed now.

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

7 participants