bloc97 / Anime4K

A High-Quality Real Time Upscaler for Anime Video
https://bloc97.github.io/Anime4K/
MIT License
18k stars 1.34k forks source link

Insane FPS lag #138

Closed pufss closed 2 years ago

pufss commented 2 years ago

As soon as I try to use the A+A(HQ) in mpv while watching a 1080p anime video, my video is only playing around 3 frames every 3 seconds, though the audio is fine. : CTRL+5 no-osd change-list glsl-shaders set "~~/shaders/Anime4K_Clamp_Highlights.glsl;~~/shaders/Anime4K_Restore_CNN_VL.glsl;~~/shaders/Anime4K_Upscale_CNN_x2_VL.glsl;~~/shaders/Anime4K_Restore_CNN_M.glsl;~~/shaders/Anime4K_AutoDownscalePre_x2.glsl;~~/shaders/Anime4K_AutoDownscalePre_x4.glsl;~~/shaders/Anime4K_Upscale_CNN_x2_M.glsl"; show-text "Anime4K: Mode A+A (HQ)"

I tried switching out some of the shaders to see which one was causing the issue. It turns out Anime4K_Upscale_CNN_x2_VL.glsl is the one giving me the trouble. If I switched to: Anime4K_Upscale_CNN_x2_M.glsl the problem goes away.

I noticed that the problem only presents itself if I tried to re-size or full-screen the video. If I just left the window size alone, the preset worked flawlessly.

To Reproduce Steps to reproduce the behavior:

  1. Open a 1920x1080p anime video.
  2. Full-screen the video
  3. Enable the A+A(HQ) preset

Expected behavior Video frames start to insanely lag, producing only a couple of frames every few seconds. The audio remains unchanged.

Screenshots If applicable, add screenshots to help explain your problem.

Desktop (please complete the following information):

Additional context My mpv.conf: `#

THIS FILE WILL BE OVERWRITTEN WITH THE PACKAGE UPDATE

Use %APPDATA%/mpv/mpv.conf

OR SVP's menu -> Information -> Add. information -> mpv config. file

to define your own customized configuration

#

Sample mpv configuration

#

this is required for SVP to "catch" the mpv

input-ipc-server=mpvpipe

hardware video decoder

hwdec=auto-copy hwdec-codecs=all

sub-font-size=40

increase subtitle font size

ALT+k add sub-scale +0.1

decrease subtitle font size

ALT+j add sub-scale -0.1

high quality video output, require rather fast video card

D3D11 renderer (default) is required for the HDR playback

profile=gpu-hq gpu-api=d3d11 scale=ewa_lanczossharp cscale=ewa_lanczossharp video-sync=display-resample

miscellaneous options

comment this one if you want mpv to remember the playback position

save-position-on-quit=no

fixes audio desync

hr-seek-framedrop=no

"ReClock" replacement

video-sync=display-resample

video-sync-max-video-change=5

log-file=mpv.log

increase subtitle font size

ALT+k add sub-scale +0.1

decrease subtitle font size

ALT+j add sub-scale -0.1 `

Jules-A commented 2 years ago

That shader combo is known to be heavy on 1080p content but I get ~35fps at 2560x1440 on an RX570 so 1fps on a 2080 Super doesn't seem right... What happens when you use hwdec=auto-safe and disable SVP? This is what it looks like for me: image

pufss commented 2 years ago

That shader combo is known to be heavy on 1080p content but I get ~35fps at 2560x1440 on an RX570 so 1fps on a 2080 Super doesn't seem right... What happens when you use hwdec=auto-safe and disable SVP? This is what it looks like for me: image

Just tried your suggestion and it doesn't seem to work. One thing I did notice is that before I full-screen the video, the gpu usage is at 25%, but as soon as I fullscreen, it drops to 0-1%.

image

image

It's reporting 8 fps in the image but the actual video seems more like a slow slideshow.

wolfdaddyh commented 2 years ago

1080p upscaled to 4k and then downscale again to 2k at 144hz is a super heavy task especially when you uses A+A mode, even my rtx 3080 uses 40% usage if I use A+A VL shader on a 1080p screen.

Jules-A commented 2 years ago

It's probably also because you are playing a HEVC file which is also heavier to decode, if you have any H264 content, see if it's also that slow.

wolfdaddyh commented 2 years ago

It's probably also because you are playing a HEVC file which is also heavier to decode, if you have any H264 content, see if it's also that slow.

Yeah, also 10bit will be more demanding than 8 bit and 3440x1440p has more pixels for the gpu to render than native 2560x1440p screen

bloc97 commented 2 years ago

This might be the same problem as https://github.com/bloc97/Anime4K/issues/134. I will update the installation instructions to specify that you need a mpv version that released after June 2021, more specifically, after this commit https://github.com/mpv-player/mpv/commit/474ee003eddd278d871e7c1c760091b739880e8f.

pufss commented 2 years ago

This might be the same problem as #134. I will update the installation instructions to specify that you need a mpv version that released after June 2021, more specifically, after this commit mpv-player/mpv@474ee00.

Can confirm this fixed my issue, thank you very much everyone for the help!