mpv-player / mpv

🎥 Command line video player
https://mpv.io
Other
27.93k stars 2.87k forks source link

[vo/gpu-next] flickering screen with combination some options #11519

Closed JiLleON closed 10 months ago

JiLleON commented 1 year ago

Important Information

My mpv case includes such a selection in config: --video-sync=display-resample --interpolation=yes --interpolation-preserve=no --tscale=sphinx --tscale-blur=0.6991556596428412 --tscale-radius=1.0 --tscale-clamp=0.0 and with such values video flickers. If I remove --tscale-radius=1.0, video stops flickering, but two or three frames flicker when rewinding occurs, as I wrote above.

At the moment I disabled the --video-latency-hacks option and continue to use mpv with --vo=gpu-next. With --vo=gpu no such problems were noticed.

I tested with two different driver versions (at first I wasn't sure if the problem is related to mpv, because I was updating drivers that day and knowing nvidia I assumed that maybe something went wrong with nvdec) and the problem occurs with both 531.29 and 531.41.

I also do not know if other systems (not Windows) are prone to similar problems. I don't expect anyone to quickly start fixing this problem (if it really is a problem and not an individual problem with my configuration) because the documentation says that this option might be removed without notice once the player's timing code does not inherently need to do these things anymore, but I thought it was worth reporting this behavior somewhere so people can stumble on this bug and understand what caused this behavior (btw I have a friend who uses my config and he complained to me about this problem after a couple days).

Log file

mpv --no-config --log-file=log.txt --vo=gpu-next --video-sync=display-resample --interpolation=yes --tscale-blur=0.72 --video-latency-hacks=yes "D:\JiLleON\Desktop\Inu ni Nattara Suki na Hito ni Hirowareta 01.mkv"

opened the video, watched a few seconds, rewound twice, watched a few more seconds, closed (video flickers) https://0x0.st/HodS.72.txt

mpv --no-config --log-file=log.txt --vo=gpu-next --video-sync=display-resample --interpolation=yes --tscale-blur=0.73 --video-latency-hacks=yes "D:\JiLleON\Desktop\Inu ni Nattara Suki na Hito ni Hirowareta 01.mkv"

opened the video, watched a few seconds, rewound two or three times, watched a few more seconds, closed (video does not flicker, but when rewinding two or three frames flicker) https://0x0.st/Hodj.73.txt

mpv --no-config --log-file=log.txt --vo=gpu-next --video-sync=display-resample --interpolation=yes --interpolation-preserve=no --tscale=sphinx --tscale-blur=0.6991556596428412 --tscale-radius=1.0 --tscale-clamp=0.0 --video-latency-hacks=yes "D:\JiLleON\Desktop\Inu ni Nattara Suki na Hito ni Hirowareta 01.mkv"

opened the video, watched a few seconds, rewound twice, watched a few more seconds, closed (video flickers) https://0x0.st/Hode.txt

mpv --no-config --log-file=log.txt --vo=gpu-next --video-sync=display-resample --interpolation=yes --interpolation-preserve=no --tscale=sphinx --tscale-blur=0.6991556596428412 --tscale-clamp=0.0 --video-latency-hacks=yes "D:\JiLleON\Desktop\Inu ni Nattara Suki na Hito ni Hirowareta 01.mkv"

opened the video, watched a few seconds, rewound two or three times, watched a few more seconds, closed (video does not flicker, but when rewinding two or three frames flicker) https://0x0.st/Hod2.0.txt

JiLleON commented 1 year ago

I forgot to mention. The video with the problem was not being recorded through OBS (as if there were no screen flickers), so I had to record it on my phone. Also recorded with --tscale=sphinx --tscale-blur=0.6991556596428412 --tscale-radius=1.0 --video-latency-hacks=yes, but the problem is exactly the same as with only --tscale-blur=0.72 --video-latency-hacks=yes instead.

awused commented 1 year ago

Ran into this myself while testing other things. Seems it was reported before in https://github.com/mpv-player/mpv/issues/9427. This does not reproduce on mpv 0.35.1 + libplacebo v208 (fedora repo) but does running git head for both libplacebo and mpv. My minimal reproduction is:

mpv --no-config --video-sync=display-resample --interpolation=yes --tscale=box --vo=gpu-next --gpu-api=vulkan --gpu-context=x11vk --gpu-debug

No reproduction on 0.35.1 + placebo 208: mpv-fedora.log Successful reproduction on git head for both: mpv-git.log

aqxa1 commented 1 year ago

I can reproduce this with some variable frame rate videos, even with --video-latency-hacks=off. Using --vo=gpu or not using any "display-*" video-sync modes works around the problem.

Enabling video-latency-hacks with the settings I use seems to only cause flickering when seeking on non-vfr videos, at least with the quick tests I did.

Dudemanguy commented 10 months ago

So the reason this happens is simply because --video-latency-hacks only queues one frame and then vo_gpu_next tries to interpolate this which naturally doesn't end well. It makes sense that a variable frame rate video could end up in the same situation. On vo_gpu, this is actually no-op. The frame is not considered valid and is never interpolated. So in fact --video-latency-hacks silently disables interpolation which makes sense given how it works (how can the VO interpolate frames if there's only 1 frame).

mpv --no-config --video-sync=display-resample --interpolation=yes --tscale=box --vo=gpu-next --gpu-api=vulkan --gpu-context=x11vk

This works for me on master however.