mpv icon indicating copy to clipboard operation
mpv copied to clipboard

mpv framerate tanks after a certain resolution

Open hegdenischay opened this issue 1 year ago • 7 comments

Summary

mpv drops frames dramatically after it reaches a certain resolution. Very similar to #8613, but it only happens with scale=ewa_lanczossharp. cscale=ewa_lanczossharp and video-sync=display-resample work without issues on my machine.

A screenshot of this video to show my point: Screenshot_20240113_144022-3

Corresponding mpv.conf:

hwdec=vaapi-copy
#profile=gpu-hq
scale=ewa_lanczossharp
hdr-peak-percentile=99.995
hdr-contrast-recovery=0.30
deband=yes

Important Information

  • mpv version: v0.37.0
  • Linux distro: Arch Linux
  • Source of mpv: distro-supplied
  • GPU: Intel HD Graphics 4400 (Intel i5-4300U CPU)

Reproduction steps

Use scale=ewa_lanczossharp in mpv.conf, or have profile=gpu-hq

Expected behavior

No frame rate drops for a static image

Actual behavior

Lots of dropped frames

Log file

mpv_log.txt

Sample files

https://0x0.st/Hlfc.mp4

hegdenischay avatar Jan 13 '24 09:01 hegdenischay

An HD 4400 is probably too weak to both upscale with a polar filter and deband, using either faster scaler or not enabling debanding should fix this. Debanding that video is useless anyway, and it'll be removed from the high-quality profile soon. #13172

No frame rate drops for a static image

It's not a static image, it's a video file where every frame is the same. This won't happen if you open a real static image like jpeg or png.

Stream #0:00x1: Video: h264 (Main) (avc1 / 0x31637661), yuv420p(progressive), 726x720 [SAR 1:1 DAR 121:120], 182 kb/s, 25 fps, 25 tbr, 12800 tbn (default)

llyyr avatar Jan 13 '24 10:01 llyyr

I agree that this video isn't mjpeg or something, but I don't think this has anything to do with debanding. I turned debanding off and tested it again with mpv v0.37.0 and mpv v0.36.0 (compiled from the source code given in GitHub releases). Whatever it is, it appears to be a recent change.

The same mpv.conf was used:

hwdec=vaapi-copy
#profile=gpu-hq
scale=ewa_lanczossharp
#cscale=ewa_lanczossharp
hdr-peak-percentile=99.995
hdr-contrast-recovery=0.30
#deband=yes

mpv v0.37.0:

Screenshot_20240114_093436

Log: mpv_new_log.txt

mpv v0.36.0:

Screenshot_20240114_093536

Log: mpv_old_log.txt

hegdenischay avatar Jan 14 '24 04:01 hegdenischay

Try vo=gpu-next? I can't think of what might cause a performance regression on vo_gpu.

You can also try setting scale=ewa_lanczossharp and cscale=bilinear on 0.37.0, because after 0.37.0 cscale will automatically follow scale if not specified.

llyyr avatar Jan 14 '24 06:01 llyyr

Thanks for the quick responses, but there's no obvious improvement. Oh, and since the other issue mentioned the DE, this is happening on KDE plasma as well as a TWM setup that I have where I use dwm with picom as a compositor.

With vo=gpu: Screenshot_20240114_153836

Log: mpv_log.txt

With vo=gpu-next: Screenshot_20240114_153915 Log: mpv_log_gpu_next.txt

hegdenischay avatar Jan 14 '24 10:01 hegdenischay

Found the exact commit that caused my current issue: https://github.com/mpv-player/mpv/commit/44cf6288c73b71d22a98870cb08b1daf9da5e048 Additionally, scaler-lut-size=8 in profile=gpu-hq was committed around 4 months ago, and that somehow escaped my radar.

With scaler-lut-size=8 on mpv v0.36.0: Screenshot_20240116_053519-1

And with scaler-lut-size=6 on mpv v0.36.0: Screenshot_20240116_053645

I think it'd be a good idea to bring that back as an option, and I have created a PR for this.

hegdenischay avatar Jan 16 '24 00:01 hegdenischay

I'm not sure if this is related, but here is my current experience with a recent mpv version: When increasing the speed of a video, the CPU usage scales nearly proportionally. Is that expected? I have used mpv for a couple of years, and this has never been the case iirc. So currently, playing a video at normal speed uses ~50% CPU, whereas playing at 3x speed causes 120% CPU usage on my laptop (Thinkpad T470P with integrated Intel graphics on Linux).

fritzrehde avatar Jan 27 '24 13:01 fritzrehde

I don't believe this is related. What codec is the video?

hegdenischay avatar Jan 28 '24 04:01 hegdenischay

Might be unrelated but I downgraded from 0.37 to 0.36 on OSx for the same reason.

giorgiopagnoni avatar Mar 11 '24 19:03 giorgiopagnoni

Might be unrelated but I downgraded from 0.37 to 0.36 on OSx for the same reason.

--profile=fast

llyyr avatar Mar 11 '24 20:03 llyyr