mpv-player / mpv

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

mpv keeps exiting fullscreen after running skip-intro.lua script #13530

Open Kagukara opened 6 months ago

Kagukara commented 6 months ago

Important Information

https://github.com/mpv-player/mpv/assets/43391109/3a3a969e-c68a-4116-80ba-7d3af4d40bc8

Reproduction steps

  1. Make sure to download and place the skip-intro.lua script from https://github.com/rui-ddc/skip-intro into your mpv scripts folder.
  2. Run a video using this command:
    mpv --no-config --script=~/.config/mpv/scripts/skip-intro.lua <your-video-here>

    or use this command to run the script from the downloads folder.:

    mpv --no-config --script=~/Downloads/skip-intro.lua <your-video-here>
  3. The video doesn't need to be playing. Press tab, press tab again if it didn't stop.
  4. mpv is now windowed

Expected behaviour

The extra/mpv 1:0.37.0-2 package on arch does the expected behaviour of when you press tab mpv doesn't go windowed when using the skip-intro.lua script. mpv-git doesn't do this.

Actual behaviour

When pressing tab the skip-intro.lua script causes the mpv window to go from fullscreen to windowed.

Log file

Command used: mpv --no-config --script=~/.config/mpv/scripts/skip-intro.lua --log-file=output.txt output.txt

Sample files

skip-intro.lua.txt

Traneptora commented 6 months ago

You need to generate a log file when actually triggering the issue, otherwise, nothing interesting will be in it.

Are you on wayland, by any chance? There were a number of wayland-specific commits last week.

Kagukara commented 6 months ago

Here is the log file with tab pressed: output.txt

Command used:

mpv -fs --no-config --script=~/.config/mpv/scripts/skip-intro.lua --log-file=output.txt '<video-here>.mkv'

Are you on wayland, by any chance?

Yes I am. Hyprland to be specific.

na-na-hi commented 6 months ago

Cannot reproduce on current git master mpv with sway version 1.9-dev-bff991df (Feb 8 2024, branch 'HEAD') on a single output setup. The script attempts to resize window if mpv is windowed but doesn't unmaximize or exit fullscreen if mpv is maximized or in fullscreen.

The log indicates that fullscreen is never set by mpv itself so I think you have custom window rules in Hyprland. You should also upload the log with WAYLAND_DEBUG=1 and also the Hyprland config file.

Dudemanguy commented 6 months ago

I can reproduce on hyprland. It's caused by 62a0292dc1eec305cfdda2b5dbfe2aff5640dfd4. The reason is because the vf filter causes a color change which does a reconfig. This did not happen before. I think this is still a hyprland bug however. The wayland backend still correctly sets xdg_toplevel_set_fullscreen in this case in which the compositor should supply us with the fullscreen coordinates. This is what happens with sway and weston which is why they do not have this problem. hyprland returns coordinates equal to the tiled state instead hence the resize.

Kagukara commented 6 months ago

I have found the problem.

mpv Command Used

mpv -fs --no-config --script=~/.config/mpv/scripts/skip-intro.lua <video-here>

As mpv used --no-config it ran with the default config throughout the tests.

Custom Config

For the initial tests I left sway and hyprland with my custom config.

Single Monitor (1)

Multi Monitor (2 or more)

hyprland-git + mpv-git + custom config = can reproduce hyprland-git + mpv + custom config = cannot reproduce

Default Config

Found here: https://github.com/hyprwm/Hyprland/blob/main/example/hyprland.conf

I then moved onto using the default config for hyprland and didn't test with sway any further.

Single Monitor (1)

Multi Monitor (2 or more)

hyprland-git + mpv-git + default config = cannot reproduce hyprland-git + mpv + default config = cannot reproduce

With the issue not happening with the default config on either mpv or mpv-git, I went through the default settings and replaced each setting until I found the problem.

The Problem

When I moved to hyprland the other day I was getting an error that wouldn't go away unless a windowrule was removed. That being this:

windowrulev2 = suppressevent maximize, class:.* # You'll probably like this.

Re-adding this back into my config no longer gives me the error in hyprland, but is also the setting stopping mpv-git from going windowed. Although with the setting removed mpv doesn't have this issue.

This still looks to me like an mpv-git problem, as hyprland just provides a patch/fix for applications that don't want to play nice with hyprland.

Log File

Running this command looks to give me the same output as not having WAYLAND_DEBUG=1, as all the WAYLAND_DEBUG=1 is in the terminal.

WAYLAND_DEBUG=1 mpv -fs --no-config --script=~/.config/mpv/scripts/skip-intro.lua --log-file=output.txt <video-here>

Even though that's the case I've copied as much as the terminal has given me to a file for you.

output.txt

wayland-debug-1.txt

hyprland-git

Hyprland, built from branch main at commit 94aeb06d6ba14d403c46b52d1d2e397acb5906a4 dirty (toplevelexport: set last damage for dmabuf copy).
Date: Thu Feb 22 03:10:01 2024
Tag: v0.35.0-69-g94aeb06d

mpv-git

$ mpv --version
mpv v0.37.0-354-gae1a4ed28a Copyright © 2000-2024 mpv/MPlayer/mplayer2 projects
 built on Feb 22 2024 14:11:49
libplacebo version: v6.338.2
FFmpeg version: n6.1.1
FFmpeg library versions:
   libavutil       58.29.100
   libavcodec      60.31.102
   libavformat     60.16.100
   libswscale      7.5.100
   libavfilter     9.12.100
   libswresample   4.12.100

mpv

$ mpv --version
mpv v0.37.0 Copyright © 2000-2023 mpv/MPlayer/mplayer2 projects
 built on Jan 19 2024 09:09:45
libplacebo version: v6.338.2
FFmpeg version: n6.1.1
FFmpeg library versions:
   libavutil       58.29.100
   libavcodec      60.31.102
   libavformat     60.16.100
   libswscale      7.5.100
   libavfilter     9.12.100
   libswresample   4.12.100
oneshotws commented 2 months ago

TL;DR

If you have Hyperland, mpv, skip-intro script and experience it - add windowrulev2 = suppressevent maximize, class:.* to Hyperland config