Mpv: Repeated values for video-rotate with cycle

Created on 29 Dec 2015  ·  6Comments  ·  Source: mpv-player/mpv

Alt+RIGHT cycle video-rotate 90
Alt+LEFT cycle video-rotate -90

If I add the above lines to input.conf, I can cycle-rotate the output in either direction. However, there are three values for an unrotated output: no, 0, 360. So I'll have to press the keys repeatedly to "get out" from the unrotated state.

question

Most helpful comment

@wm4 I agree that cycling through video-rotate shouldn't be special-cased. That would feel like a dirty hack.

And the method by @kevmitch with cycling specific values has its own big drawbacks (try rotating left the first thing you do when you open a video).

Might as well just solve this rotate clockwise/counter-clockwise situation via Lua, like I did here:

https://github.com/mpv-player/mpv/issues/3869#issuecomment-267739403


Edit: I've now published this and a few other scripts on the wiki:

https://github.com/mpv-player/mpv/wiki/User-Scripts

  • auto-keep-gui-open
    Intelligently switches mpv's "keep-open" behavior based on whether you are running in video-mode or audio-only mode.

  • cycle-video-rotate
    Allows you to perform video rotation which perfectly cycles through all 360 degrees without any glitches.

  • multi-command-if
    Very powerful conditional logic and multiple action engine for your keybindings, without having to write a single line of code!

  • quick-scale
    Quickly scale the video player to a target size, with full control over target scale and max scale. Helps you effortlessly resize a video to fit on your desktop, or any other video dimensions you need!

All 6 comments

I think the best you can do is

RIGHT cycle_values video-rotate 90 180 270 0
LEFT cycle_values !reverse video-rotate 90 180 270 0

the only problem is that the if you rotate left first it will go to 0

Yes, this is how it works. While rotating through no makes no sense in this case, it's (probably) needed for other properties. (In theory, the video-rotate property could be special-cased, but personally I don't feel like doing this.)

I just wonder why "0" and "360" exists in the list when I do "cycle".

I mean, shouldn't the accepted range be 1-359 instead of 0-360 anyway? 0 and 360 will just be no-op and make no sense.

[tom@localhost ~]$ mpv --video-rotate=361
Invalid value for option video-rotate: 361
Valid values are:
no
0-360 (integer range)
Error parsing option video-rotate (option could not be parsed)
Setting command line option '--video-rotate=361' failed.

Exiting... (Fatal error)

0 and no are different. no prevents the container rotation flag from being applied. 0 is simply the default value. But I can remove 360.

@wm4 I agree that cycling through video-rotate shouldn't be special-cased. That would feel like a dirty hack.

And the method by @kevmitch with cycling specific values has its own big drawbacks (try rotating left the first thing you do when you open a video).

Might as well just solve this rotate clockwise/counter-clockwise situation via Lua, like I did here:

https://github.com/mpv-player/mpv/issues/3869#issuecomment-267739403


Edit: I've now published this and a few other scripts on the wiki:

https://github.com/mpv-player/mpv/wiki/User-Scripts

  • auto-keep-gui-open
    Intelligently switches mpv's "keep-open" behavior based on whether you are running in video-mode or audio-only mode.

  • cycle-video-rotate
    Allows you to perform video rotation which perfectly cycles through all 360 degrees without any glitches.

  • multi-command-if
    Very powerful conditional logic and multiple action engine for your keybindings, without having to write a single line of code!

  • quick-scale
    Quickly scale the video player to a target size, with full control over target scale and max scale. Helps you effortlessly resize a video to fit on your desktop, or any other video dimensions you need!

Was this page helpful?
0 / 5 - 0 ratings