summaryrefslogtreecommitdiffstats
path: root/DOCS/man/input.rst
diff options
context:
space:
mode:
Diffstat (limited to 'DOCS/man/input.rst')
-rw-r--r--DOCS/man/input.rst2117
1 files changed, 1716 insertions, 401 deletions
diff --git a/DOCS/man/input.rst b/DOCS/man/input.rst
index 2b483a4f05..df4766b5be 100644
--- a/DOCS/man/input.rst
+++ b/DOCS/man/input.rst
@@ -41,14 +41,16 @@ commands they're bound to on the OSD, instead of executing the commands::
(Only closing the window will make **mpv** exit, pressing normal keys will
merely display the binding, even if mapped to quit.)
+Also see `Key names`_.
+
input.conf syntax
-----------------
``[Shift+][Ctrl+][Alt+][Meta+]<key> [{<section>}] <command> ( ; <command> )*``
Note that by default, the right Alt key can be used to create special
-characters, and thus does not register as a modifier. The option
-``--no-input-right-alt-gr`` changes this behavior.
+characters, and thus does not register as a modifier. This can be changed
+with ``--input-right-alt-gr`` option.
Newlines always start a new binding. ``#`` starts a comment (outside of quoted
string arguments). To bind commands to the ``#`` key, ``SHARP`` can be used.
@@ -60,8 +62,8 @@ character), or a symbolic name (as printed by ``--input-keylist``).
command.
``<command>`` is the command itself. It consists of the command name and
-multiple (or none) commands, all separated by whitespace. String arguments
-need to be quoted with ``"``. Details see ``Flat command syntax``.
+multiple (or none) arguments, all separated by whitespace. String arguments
+should be quoted, typically with ``"``. See ``Flat command syntax``.
You can bind multiple commands to one key. For example:
@@ -78,25 +80,124 @@ that matches, and the multi-key command will never be called. Intermediate keys
can be remapped to ``ignore`` in order to avoid this issue. The maximum number
of (non-modifier) keys for combinations is currently 4.
+Key names
+---------
+
+All mouse and keyboard input is to converted to mpv-specific key names. Key
+names are either special symbolic identifiers representing a physical key, or a
+text key names, which are unicode code points encoded as UTF-8. These are what
+keyboard input would normally produce, for example ``a`` for the A key. As a
+consequence, mpv uses input translated by the current OS keyboard layout, rather
+than physical scan codes.
+
+Currently there is the hardcoded assumption that every text key can be
+represented as a single unicode code point (in NFKC form).
+
+All key names can be combined with the modifiers ``Shift``, ``Ctrl``, ``Alt``,
+``Meta``. They must be prefixed to the actual key name, where each modifier
+is followed by a ``+`` (for example ``ctrl+q``).
+
+The ``Shift`` modifier requires some attention. For instance ``Shift+2`` should
+usually be specified as key-name ``@`` at ``input.conf``, and similarly the
+combination ``Alt+Shift+2`` is usually ``Alt+@``, etc. Special key names like
+``Shift+LEFT`` work as expected. If in doubt - use ``--input-test`` to check
+how a key/combination is seen by mpv.
+
+Symbolic key names and modifier names are case-insensitive. Unicode key names
+are case-sensitive because input bindings typically respect the shift key.
+
+Another type of key names are hexadecimal key names, that serve as fallback
+for special keys that are neither unicode, nor have a special mpv defined name.
+They will break as soon as mpv adds proper names for them, but can enable you
+to use a key at all if that does not happen.
+
+All symbolic names are listed by ``--input-keylist``. ``--input-test`` is a
+special mode that prints all input on the OSD.
+
+Comments on some symbolic names:
+
+``KP*``
+ Keypad names. Behavior varies by backend (whether they implement this, and
+ on how they treat numlock), but typically, mpv tries to map keys on the
+ keypad to separate names, even if they produce the same text as normal keys.
+
+``MOUSE_BTN*``, ``MBTN*``
+ Various mouse buttons.
+
+ Depending on backend, the mouse wheel might also be represented as a button.
+ In addition, ``MOUSE_BTN3`` to ``MOUSE_BTN6`` are deprecated aliases for
+ ``WHEEL_UP``, ``WHEEL_DOWN``, ``WHEEL_LEFT``, ``WHEEL_RIGHT``.
+
+ ``MBTN*`` are aliases for ``MOUSE_BTN*``.
+
+``WHEEL_*``
+ Mouse wheels (typically).
+
+``AXIS_*``
+ Deprecated aliases for ``WHEEL_*``.
+
+``*_DBL``
+ Mouse button double clicks.
+
+``MOUSE_MOVE``, ``MOUSE_ENTER``, ``MOUSE_LEAVE``
+ Emitted by mouse move events. Enter/leave happens when the mouse enters or
+ leave the mpv window (or the current mouse region, using the deprecated
+ mouse region input section mechanism).
+
+``CLOSE_WIN``
+ Pseudo key emitted when closing the mpv window using the OS window manager
+ (for example, by clicking the close button in the window title bar).
+
+``GAMEPAD_*``
+ Keys emitted by the SDL gamepad backend.
+
+``UNMAPPED``
+ Pseudo-key that matches any unmapped key. (You should probably avoid this
+ if possible, because it might change behavior or get removed in the future.)
+
+``ANY_UNICODE``
+ Pseudo-key that matches any key that produces text. (You should probably
+ avoid this if possible, because it might change behavior or get removed in
+ the future.)
+
Flat command syntax
-------------------
This is the syntax used in input.conf, and referred to "input.conf syntax" in
a number of other places.
-``<command> ::= [<prefixes>] <command_name> (<argument>)*``
-``<argument> ::= (<string> | " <quoted_string> " )``
+|
+| ``<command> ::= [<prefixes>] <command_name> (<argument>)*``
+| ``<argument> ::= (<unquoted> | " <double_quoted> " | ' <single_quoted> ' | `X <custom_quoted> X`)``
``command_name`` is an unquoted string with the command name itself. See
`List of Input Commands`_ for a list.
-Arguments are separated by whitespace. This applies even to string arguments.
-For this reason, string arguments should be quoted with ``"``. If a string
-argument contains spaces or certain special characters, quoting and possibly
-escaping is mandatory, or the command cannot be parsed correctly.
+Arguments are separated by whitespaces even if the command expects only one
+argument. Arguments with whitespaces or other special characters must be quoted,
+or the command cannot be parsed correctly.
-Inside quotes, C-style escaping can be used. JSON escapes according to RFC 8259,
-minus surrogate pair escapes, should be a safe subset that can be used.
+Double quotes interpret JSON/C-style escaping, like ``\t`` or ``\"`` or ``\\``.
+JSON escapes according to RFC 8259, minus surrogate pair escapes. This is the
+only form which allows newlines at the value - as ``\n``.
+
+Single quotes take the content literally, and cannot include the single-quote
+character at the value.
+
+Custom quotes also take the content literally, but are more flexible than single
+quotes. They start with ````` (back-quote) followed by any ASCII character,
+and end at the first occurrence of the same pair in reverse order, e.g.
+```-foo-``` or ````bar````. The final pair sequence is not allowed at the
+value - in these examples ``-``` and `````` respectively. In the second
+example the last character of the value also can't be a back-quote.
+
+Mixed quoting at the same argument, like ``'foo'"bar"``, is not supported.
+
+Note that argument parsing and property expansion happen at different stages.
+First, arguments are determined as described above, and then, where applicable,
+properties are expanded - regardless of argument quoting. However, expansion
+can still be prevented with the ``raw`` prefix or ``$>``. See `Input Command
+Prefixes`_ and `Property Expansion`_.
Commands specified as arrays
----------------------------
@@ -119,6 +220,9 @@ quotes and escaping. The array command APIs mentioned above pass strings
directly to the argument parsers, or can sidestep them by the ability to pass
non-string values.
+Property expansion is disabled by default for these APIs. This can be changed
+with the ``expand-properties`` prefix. See `Input Command Prefixes`_.
+
Sometimes commands have string arguments, that in turn are actually parsed by
other components (e.g. filter strings with ``vf add``) - in these cases, you
you would have to double-escape in input.conf, but not with the array APIs.
@@ -134,11 +238,10 @@ This applies to certain APIs, such as ``mp.command_native()`` (with tables that
have string keys) in Lua scripting, or ``mpv_command_node()`` (with
MPV_FORMAT_NODE_MAP) in the C libmpv client API.
-Like with array commands, quoting and escaping is inherently not needed in the
-normal case.
-
-The name of each command is defined in each command description in the
-`List of Input Commands`_. ``--input-cmdlist`` also lists them.
+The name of the command is provided with a ``name`` string field. The name of
+each command is defined in each command description in the
+`List of Input Commands`_. ``--input-cmdlist`` also lists them. See the
+``subprocess`` command for an example.
Some commands do not support named arguments (e.g. ``run`` command). You need
to use APIs that pass arguments as arrays.
@@ -146,6 +249,9 @@ to use APIs that pass arguments as arrays.
Named arguments are not supported in the "flat" input.conf syntax, which means
you cannot use them for key bindings in input.conf at all.
+Property expansion is disabled by default for these APIs. This can be changed
+with the ``expand-properties`` prefix. See `Input Command Prefixes`_.
+
List of Input Commands
----------------------
@@ -158,7 +264,7 @@ Remember to quote string arguments in input.conf (see `Flat command syntax`_).
``ignore``
Use this to "block" keys that should be unbound, and do nothing. Useful for
disabling default bindings, without disabling all bindings with
- ``--no-input-default-bindings``.
+ ``--input-default-bindings=no``.
``seek <target> [<flags>]``
Change the playback position. By default, seeks by a relative amount of
@@ -201,6 +307,12 @@ Remember to quote string arguments in input.conf (see `Flat command syntax`_).
Mark the current time position. The next normal ``revert-seek`` command
will seek back to this point, no matter how many seeks happened since
last time.
+ mark-permanent
+ If set, mark the current position, and do not change the mark position
+ before the next ``revert-seek`` command that has ``mark`` or
+ ``mark-permanent`` set (or playback of the current file ends). Until
+ this happens, ``revert-seek`` will always seek to the marked point. This
+ flag cannot be combined with ``mark``.
Using it without any arguments gives you the default behavior.
@@ -222,6 +334,9 @@ Remember to quote string arguments in input.conf (see `Flat command syntax`_).
``set <name> <value>``
Set the given property or option to the given value.
+``del <name>``
+ Delete the given property. Most properties cannot be deleted.
+
``add <name> [<value>]``
Add the given value to the property or option. On overflow or underflow,
clamp the property to the maximum. If ``<value>`` is omitted, assume ``1``.
@@ -232,6 +347,10 @@ Remember to quote string arguments in input.conf (see `Flat command syntax`_).
the minimum, on underflow set it to the maximum. If ``up`` or ``down`` is
omitted, assume ``up``.
+ Whether or not key-repeat is enabled by default depends on the property.
+ Currently properties with continuous values are repeatable by default (like
+ ``volume``), while discrete values are not (like ``osd-level``).
+
``multiply <name> <value>``
Similar to ``add``, but multiplies the property or option with the numeric
value.
@@ -250,8 +369,7 @@ Remember to quote string arguments in input.conf (see `Flat command syntax`_).
behavior depends on the selected video output.
<window>
Save the contents of the mpv window. Typically scaled, with OSD and
- subtitles. The exact behavior depends on the selected video output, and
- if no support is available, this will act like ``video``.
+ subtitles. The exact behavior depends on the selected video output.
<each-frame>
Take a screenshot each frame. Issue this command again to stop taking
screenshots. Note that you should disable frame-dropping when using
@@ -268,6 +386,9 @@ Remember to quote string arguments in input.conf (see `Flat command syntax`_).
normal standalone commands, this is always asynchronous, and the flag has
no effect. (This behavior changed with mpv 0.29.0.)
+ On success, returns a ``mpv_node`` with a ``filename`` field set to the
+ saved screenshot location.
+
``screenshot-to-file <filename> <flags>``
Take a screenshot and save it to a given file. The format of the file will
be guessed by the extension (and ``--screenshot-format`` is ignored - the
@@ -301,8 +422,42 @@ Remember to quote string arguments in input.conf (see `Flat command syntax`_).
force
Terminate playback if the first file is being played.
-``loadfile <url> [<flags> [<options>]]``
- Load the given file or URL and play it.
+``playlist-next-playlist``
+ Go to the next entry on the playlist with a different ``playlist-path``.
+
+``playlist-prev-playlist``
+ Go to the first of the previous entries on the playlist with a different
+ ``playlist-path``.
+
+``playlist-play-index <integer|current|none>``
+ Start (or restart) playback of the given playlist index. In addition to the
+ 0-based playlist entry index, it supports the following values:
+
+ <current>
+ The current playlist entry (as in ``playlist-current-pos``) will be
+ played again (unload and reload). If none is set, playback is stopped.
+ (In corner cases, ``playlist-current-pos`` can point to a playlist entry
+ even if playback is currently inactive,
+
+ <none>
+ Playback is stopped. If idle mode (``--idle``) is enabled, the player
+ will enter idle mode, otherwise it will exit.
+
+ This command is similar to ``loadfile`` in that it only manipulates the
+ state of what to play next, without waiting until the current file is
+ unloaded, and the next one is loaded.
+
+ Setting ``playlist-pos`` or similar properties can have a similar effect to
+ this command. However, it's more explicit, and guarantees that playback is
+ restarted if for example the new playlist entry is the same as the previous
+ one.
+
+``loadfile <url> [<flags> [<index> [<options>]]]``
+ Load the given file or URL and play it. Technically, this is just a playlist
+ manipulation command (which either replaces the playlist or adds an entry
+ to it). Actual file loading happens independently. For example, a
+ ``loadfile`` command that replaces the current file with a new one returns
+ before the current file is stopped, and the new file even begins loading.
Second argument:
@@ -314,13 +469,34 @@ Remember to quote string arguments in input.conf (see `Flat command syntax`_).
Append the file, and if nothing is currently playing, start playback.
(Always starts with the added file, even if the playlist was not empty
before running this command.)
-
- The third argument is a list of options and values which should be set
+ <insert-next>
+ Insert the file into the playlist, directly after the current entry.
+ <insert-next-play>
+ Insert the file next, and if nothing is currently playing, start playback.
+ (Always starts with the added file, even if the playlist was not empty
+ before running this command.)
+ <insert-at>
+ Insert the file into the playlist, at the index given in the third
+ argument.
+ <insert-at-play>
+ Insert the file at the index given in the third argument, and if nothing
+ is currently playing, start playback. (Always starts with the added
+ file, even if the playlist was not empty before running this command.)
+
+ The third argument is an insertion index, used only by the ``insert-at`` and
+ ``insert-at-play`` actions. When used with those actions, the new item will
+ be inserted at the index position in the playlist, or appended to the end if
+ index is less than 0 or greater than the size of the playlist. This argument
+ will be ignored for all other actions.
+
+ The fourth argument is a list of options and values which should be set
while the file is playing. It is of the form ``opt1=value1,opt2=value2,..``.
- Not all options can be changed this way. Some options require a restart
- of the player.
+ When using the client API, this can be a ``MPV_FORMAT_NODE_MAP`` (or a Lua
+ table), however the values themselves must be strings currently. These
+ options are set during playback, and restored to the previous value at end
+ of playback (see `Per-File Options`_).
-``loadlist <url> [<flags>]``
+``loadlist <url> [<flags> [<index>]]``
Load the given playlist file or URL (like ``--playlist``).
Second argument:
@@ -329,6 +505,30 @@ Remember to quote string arguments in input.conf (see `Flat command syntax`_).
Stop playback and replace the internal playlist with the new one.
<append>
Append the new playlist at the end of the current internal playlist.
+ <append-play>
+ Append the new playlist, and if nothing is currently playing, start
+ playback. (Always starts with the new playlist, even if the internal
+ playlist was not empty before running this command.)
+ <insert-next>
+ Insert the new playlist into the current internal playlist, directly
+ after the current entry.
+ <insert-next-play>
+ Insert the new playlist, and if nothing is currently playing, start
+ playback. (Always starts with the new playlist, even if the internal
+ playlist was not empty before running this command.)
+ <insert-at>
+ Insert the new playlist at the index given in the third argument.
+ <insert-at-play>
+ Insert the new playlist at the index given in the third argument, and if
+ nothing is currently playing, start playback. (Always starts with the
+ new playlist, even if the internal playlist was not empty before running
+ this command.)
+
+ The third argument is an insertion index, used only by the ``insert-at`` and
+ ``insert-at-play`` actions. When used with those actions, the new playlist
+ will be inserted at the index position in the internal playlist, or appended
+ to the end if index is less than 0 or greater than the size of the internal
+ playlist. This argument will be ignored for all other actions.
``playlist-clear``
Clear the playlist, except the currently played file.
@@ -350,6 +550,12 @@ Remember to quote string arguments in input.conf (see `Flat command syntax`_).
Shuffle the playlist. This is similar to what is done on start if the
``--shuffle`` option is used.
+``playlist-unshuffle``
+ Attempt to revert the previous ``playlist-shuffle`` command. This works
+ only once (multiple successive ``playlist-unshuffle`` commands do nothing).
+ May not work correctly if new recursive playlists have been opened since
+ a ``playlist-shuffle`` command.
+
``run <command> [<arg1> [<arg2> [...]]]``
Run the given command. Unlike in MPlayer/mplayer2 and earlier versions of
mpv (0.2.x and older), this doesn't call the shell. Instead, the command
@@ -378,6 +584,9 @@ Remember to quote string arguments in input.conf (see `Flat command syntax`_).
Similar to ``run``, but gives more control about process execution to the
caller, and does does not detach the process.
+ You can avoid blocking until the process terminates by running this command
+ asynchronously. (For example ``mp.command_native_async()`` in Lua scripting.)
+
This has the following named arguments. The order of them is not guaranteed,
so you should always call them with named arguments, see `Named arguments`_.
@@ -387,15 +596,15 @@ Remember to quote string arguments in input.conf (see `Flat command syntax`_).
argument list.
The first array entry is either an absolute path to the executable, or
- a filename with no path components, in which case the ``PATH``
- environment variable. On Unix, this is equivalent to ``posix_spawnp``
- and ``execvp`` behavior.
+ a filename with no path components, in which case the executable is
+ searched in the directories in the ``PATH`` environment variable. On
+ Unix, this is equivalent to ``posix_spawnp`` and ``execvp`` behavior.
``playback_only`` (``MPV_FORMAT_FLAG``)
Boolean indicating whether the process should be killed when playback
- terminates (optional, default: yes). If enabled, stopping playback
- will automatically kill the process, and you can't start it outside of
- playback.
+ of the current playlist entry terminates (optional, default: true). If
+ enabled, stopping playback will automatically kill the process, and you
+ can't start it outside of playback.
``capture_size`` (``MPV_FORMAT_INT64``)
Integer setting the maximum number of stdout plus stderr bytes that can
@@ -409,15 +618,47 @@ Remember to quote string arguments in input.conf (see `Flat command syntax`_).
``capture_stderr`` (``MPV_FORMAT_FLAG``)
Same as ``capture_stdout``, but for stderr.
+ ``detach`` (``MPV_FORMAT_FLAG``)
+ Whether to run the process in detached mode (optional, default: no). In
+ this mode, the process is run in a new process session, and the command
+ does not wait for the process to terminate. If neither
+ ``capture_stdout`` nor ``capture_stderr`` have been set to true,
+ the command returns immediately after the new process has been started,
+ otherwise the command will read as long as the pipes are open.
+
+ ``env`` (``MPV_FORMAT_NODE_ARRAY[MPV_FORMAT_STRING]``)
+ Set a list of environment variables for the new process (default: empty).
+ If an empty list is passed, the environment of the mpv process is used
+ instead. (Unlike the underlying OS mechanisms, the mpv command cannot
+ start a process with empty environment. Fortunately, that is completely
+ useless.) The format of the list is as in the ``execle()`` syscall. Each
+ string item defines an environment variable as in ``NAME=VALUE``.
+
+ On Lua, you may use ``utils.get_env_list()`` to retrieve the current
+ environment if you e.g. simply want to add a new variable.
+
+ ``stdin_data`` (``MPV_FORMAT_STRING``)
+ Feed the given string to the new process' stdin. Since this is a string,
+ you cannot pass arbitrary binary data. If the process terminates or
+ closes the pipe before all data is written, the remaining data is
+ silently discarded. Probably does not work on win32.
+
+ ``passthrough_stdin`` (``MPV_FORMAT_FLAG``)
+ If enabled, wire the new process' stdin to mpv's stdin (default: no).
+ Before mpv 0.33.0, this argument did not exist, but the behavior was as
+ if this was set to true.
+
The command returns the following result (as ``MPV_FORMAT_NODE_MAP``):
``status`` (``MPV_FORMAT_INT64``)
- The raw exit status of the process. It will be negative on error. The
- meaning of negative values is undefined, other than meaning error (and
- does not necessarily correspond to OS low level exit status values).
-
- On Windows, it can happen that a negative return value is returned
- even if the process exits gracefully, because the win32 ``UINT`` exit
+ Typically this is the process exit code (0 or positive) if the process
+ terminates normally, or negative for other errors (failed to start,
+ terminated by mpv, and others). The meaning of negative values is
+ undefined, other than meaning error (and does not correspond to OS low
+ level exit status values).
+
+ On Windows, it can happen that a negative return value is returned even
+ if the process terminates normally, because the win32 ``UINT`` exit
code is assigned to an ``int`` variable before being set as ``int64_t``
field in the result map. This might be fixed later.
@@ -428,26 +669,53 @@ Remember to quote string arguments in input.conf (see `Flat command syntax`_).
Same as ``stdout``, but for stderr.
``error_string`` (``MPV_FORMAT_STRING``)
- Empty string if the process exited gracefully. The string ``killed`` if
- the process was terminated in an unusual way. The string ``init`` if the
- process could not be started.
+ Empty string if the process terminated normally. The string ``killed``
+ if the process was terminated in an unusual way. The string ``init`` if
+ the process could not be started.
On Windows, ``killed`` is only returned when the process has been
- killed by mpv as a result of ``playback_only`` being set to ``yes``.
+ killed by mpv as a result of ``playback_only`` being set to true.
``killed_by_us`` (``MPV_FORMAT_FLAG``)
- Set to ``yes`` if the process has been killed by mpv as a result
- of ``playback_only`` being set to ``yes``.
+ Whether the process has been killed by mpv, for example as a result of
+ ``playback_only`` being set to true, aborting the command (e.g. by
+ ``mp.abort_async_command()``), or if the player is about to exit.
Note that the command itself will always return success as long as the
parameters are correct. Whether the process could be spawned or whether
it was somehow killed or returned an error status has to be queried from
the result value.
- This command can be asynchronously aborted via API.
+ This command can be asynchronously aborted via API. Also see `Asynchronous
+ command details`_. Only the ``run`` command can start processes in a truly
+ detached way.
+
+ .. note:: The subprocess will always be terminated on player exit if it
+ wasn't started in detached mode, even if ``playback_only`` is
+ false.
+
+ .. warning::
+
+ Don't forget to set the ``playback_only`` field to false if you want
+ the command to run while the player is in idle mode, or if you don't
+ want the end of playback to kill the command.
+
+ .. admonition:: Example
+
+ ::
+
+ local r = mp.command_native({
+ name = "subprocess",
+ playback_only = false,
+ capture_stdout = true,
+ args = {"cat", "/proc/cpuinfo"},
+ })
+ if r.status == 0 then
+ print("result: " .. r.stdout)
+ end
- In all cases, the subprocess will be terminated on player exit. Only the
- ``run`` command can start processes in a truly detached way.
+ This is a fairly useless Lua example, which demonstrates how to run
+ a process in a blocking manner, and retrieving its stdout output.
``quit [<code>]``
Exit the player. If an argument is given, it's used as process exit code.
@@ -455,7 +723,7 @@ Remember to quote string arguments in input.conf (see `Flat command syntax`_).
``quit-watch-later [<code>]``
Exit player, and store current playback position. Playing that file later
will seek to the previous position on start. The (optional) argument is
- exactly as in the ``quit`` command.
+ exactly as in the ``quit`` command. See `RESUMING PLAYBACK`_.
``sub-add <url> [<flags> [<title> [<lang>]]]``
Load the given subtitle file or stream. By default, it is selected as
@@ -494,19 +762,37 @@ Remember to quote string arguments in input.conf (see `Flat command syntax`_).
This works by unloading and re-adding the subtitle track.
-``sub-step <skip>``
+``sub-step <skip> <flags>``
Change subtitle timing such, that the subtitle event after the next
``<skip>`` subtitle events is displayed. ``<skip>`` can be negative to step
backwards.
-``sub-seek <skip>``
- Seek to the next (skip set to 1) or the previous (skip set to -1) subtitle.
+ Secondary argument:
+
+ primary (default)
+ Steps through the primary subtitles.
+ secondary
+ Steps through the secondary subtitles.
+
+``sub-seek <skip> <flags>``
+ Change video and audio position such that the subtitle event after
+ ``<skip>`` subtitle events is displayed. For example, ``sub-seek 1`` skips
+ to the next subtitle, ``sub-seek -1`` skips to the previous subtitles, and
+ ``sub-seek 0`` seeks to the beginning of the current subtitle.
+
This is similar to ``sub-step``, except that it seeks video and audio
instead of adjusting the subtitle delay.
+ Secondary argument:
+
+ primary (default)
+ Seeks through the primary subtitles.
+ secondary
+ Seeks through the secondary subtitles.
+
For embedded subtitles (like with Matroska), this works only with subtitle
events that have already been displayed, or are within a short prefetch
- range.
+ range. See `Cache`_ for details on how to control the available prefetch range.
``print-text <text>``
Print text to stdout. The string can contain properties (see
@@ -515,7 +801,7 @@ Remember to quote string arguments in input.conf (see `Flat command syntax`_).
``show-text <text> [<duration>|-1 [<level>]]``
Show text on the OSD. The string can contain properties, which are expanded
as described in `Property Expansion`_. This can be used to show playback
- time, filename, and so on.
+ time, filename, and so on. ``no-osd`` has no effect on this command.
<duration>
The time in ms to show the message for. By default, it uses the same
@@ -524,24 +810,76 @@ Remember to quote string arguments in input.conf (see `Flat command syntax`_).
<level>
The minimum OSD level to show the text at (see ``--osd-level``).
-``expand-text <string>``
+``expand-text <text>``
Property-expand the argument and return the expanded string. This can be
used only through the client API or from a script using
``mp.command_native``. (see `Property Expansion`_).
+``expand-path "<text>"``
+ Expand a path's double-tilde placeholders into a platform-specific path.
+ As ``expand-text``, this can only be used through the client API or from
+ a script using ``mp.command_native``.
+
+ .. admonition:: Example
+
+ ``mp.osd_message(mp.command_native({"expand-path", "~~home/"}))``
+
+ This line of Lua would show the location of the user's mpv
+ configuration directory on the OSD.
+
+``normalize-path <filename>``
+ Return a canonical representation of the path ``filename`` by converting it
+ to an absolute path, removing consecutive slashes, removing ``.``
+ components, resolving ``..`` components, and converting slashes to
+ backslashes on Windows. Symlinks are not resolved unless the platform is
+ Unix-like and one of the path components is ``..``. If ``filename`` is a
+ URL, it is returned unchanged. This can only be used through the client API
+ or from a script using ``mp.command_native``.
+
+ .. admonition:: Example
+
+ ``mp.osd_message(mp.command_native({"normalize-path", "/foo//./bar"}))``
+
+ This line of Lua prints "/foo/bar" on the OSD.
+
+``escape-ass <text>``
+ Modify ``text`` so that commands and functions that interpret ASS tags,
+ such as ``osd-overlay`` and ``mp.create_osd_overlay``, will display it
+ verbatim, and return it. This can only be used through the client API or
+ from a script using ``mp.command_native``.
+
+ .. admonition:: Example
+
+ ``mp.osd_message(mp.command_native({"escape-ass", "foo {bar}"}))``
+
+ This line of Lua prints "foo \\{bar}" on the OSD.
+
``show-progress``
Show the progress bar, the elapsed time and the total duration of the file
- on the OSD.
+ on the OSD. ``no-osd`` has no effect on this command.
``write-watch-later-config``
Write the resume config file that the ``quit-watch-later`` command writes,
but continue playback normally.
-``stop``
+``delete-watch-later-config [<filename>]``
+ Delete any existing resume config file that was written by
+ ``quit-watch-later`` or ``write-watch-later-config``. If a filename is
+ specified, then the deleted config is for that file; otherwise, it is the
+ same one as would be written by ``quit-watch-later`` or
+ ``write-watch-later-config`` in the current circumstance.
+
+``stop [<flags>]``
Stop playback and clear playlist. With default settings, this is
essentially like ``quit``. Useful for the client API: playback can be
stopped without terminating the player.
+ The first argument is optional, and supports the following flags:
+
+ keep-playlist
+ Do not clear the playlist.
+
+
``mouse <x> <y> [<button> [<mode>]]``
Send a mouse event with given coordinate (``<x>``, ``<y>``).
@@ -559,11 +897,13 @@ Remember to quote string arguments in input.conf (see `Flat command syntax`_).
<double>
The mouse event represents double-click.
-``keypress <name>``
+``keypress <name> [<scale>]``
Send a key event through mpv's input handler, triggering whatever
behavior is configured to that key. ``name`` uses the ``input.conf``
- naming scheme for keys and modifiers. Useful for the client API: key events
- can be sent to libmpv to handle internally.
+ naming scheme for keys and modifiers. ``scale`` is used to scale numerical
+ change effected by the bound command (same mechanism as precise scrolling).
+ Useful for the client API: key events can be sent to libmpv to handle
+ internally.
``keydown <name>``
Similar to ``keypress``, but sets the ``KEYDOWN`` flag so that if the key is
@@ -576,6 +916,12 @@ Remember to quote string arguments in input.conf (see `Flat command syntax`_).
empty string, ``KEYUP`` will be set on all keys. Otherwise, ``KEYUP`` will
only be set on the key specified by ``name``.
+``keybind <name> <command>``
+ Binds a key to an input command. ``command`` must be a complete command
+ containing all the desired arguments and flags. Both ``name`` and
+ ``command`` use the ``input.conf`` naming scheme. This is primarily
+ useful for the client API.
+
``audio-add <url> [<flags> [<title> [<lang>]]]``
Load the given audio file. See ``sub-add`` command.
@@ -585,10 +931,22 @@ Remember to quote string arguments in input.conf (see `Flat command syntax`_).
``audio-reload [<id>]``
Reload the given audio tracks. See ``sub-reload`` command.
+``video-add <url> [<flags> [<title> [<lang> [<albumart>]]]]``
+ Load the given video file. See ``sub-add`` command for common options.
+
+ ``albumart`` (``MPV_FORMAT_FLAG``)
+ If enabled, mpv will load the given video as album art.
+
+``video-remove [<id>]``
+ Remove the given video track. See ``sub-remove`` command.
+
+``video-reload [<id>]``
+ Reload the given video tracks. See ``sub-reload`` command.
+
``rescan-external-files [<mode>]``
- Rescan external files according to the current ``--sub-auto`` and
- ``--audio-file-auto`` settings. This can be used to auto-load external
- files *after* the file was loaded.
+ Rescan external files according to the current ``--sub-auto``,
+ ``--audio-file-auto`` and ``--cover-art-auto`` settings. This can be used
+ to auto-load external files *after* the file was loaded.
The ``mode`` argument is one of the following:
@@ -600,6 +958,9 @@ Remember to quote string arguments in input.conf (see `Flat command syntax`_).
<keep-selection>
Do not change current track selections.
+``context-menu``
+ Show context menu on the video window. See `Context Menu`_ section for details.
+
Input Commands that are Possibly Subject to Change
--------------------------------------------------
@@ -610,6 +971,10 @@ Input Commands that are Possibly Subject to Change
``vf <operation> <value>``
Change video filter chain.
+ The semantics are exactly the same as with option parsing (see
+ `VIDEO FILTERS`_). As such the text below is a redundant and incomplete
+ summary.
+
The first argument decides what happens:
<set>
@@ -619,8 +984,8 @@ Input Commands that are Possibly Subject to Change
Append the new filter chain to the previous one.
<toggle>
- Check if the given filter (with the exact parameters) is already
- in the video chain. If yes, remove the filter. If no, add the filter.
+ Check if the given filter (with the exact parameters) is already in the
+ video chain. If it is, remove the filter. If it isn't, add the filter.
(If several filters are passed to the command, this is done for
each filter.)
@@ -628,12 +993,8 @@ Input Commands that are Possibly Subject to Change
without filter name and parameters as filter entry. This toggles the
enable/disable flag.
- <del>
- Remove the given filters from the video chain. Unlike in the other
- cases, the second parameter is a comma separated list of filter names
- or integer indexes. ``0`` would denote the first filter. Negative
- indexes start from the last filter, and ``-1`` denotes the last
- filter.
+ <remove>
+ Like ``toggle``, but always remove the given filter from the chain.
<clr>
Remove all filters. Note that like the other sub-commands, this does
@@ -659,7 +1020,7 @@ Input Commands that are Possibly Subject to Change
.. admonition:: Example for input.conf
- - ``a vf set flip`` turn video upside-down on the ``a`` key
+ - ``a vf set vflip`` turn the video upside-down on the ``a`` key
- ``b vf set ""`` remove all video filters on ``b``
- ``c vf toggle gradfun`` toggle debanding on ``c``
@@ -689,6 +1050,8 @@ Input Commands that are Possibly Subject to Change
list yourself when adding a second key binding for cycling backwards.
``enable-section <name> [<flags>]``
+ This command is deprecated, except for mpv-internal uses.
+
Enable all key bindings in the named input section.
The enabled input sections form a stack. Bindings in sections on the top of
@@ -711,9 +1074,13 @@ Input Commands that are Possibly Subject to Change
Same.
``disable-section <name>``
+ This command is deprecated, except for mpv-internal uses.
+
Disable the named input section. Undoes ``enable-section``.
``define-section <name> <contents> [<flags>]``
+ This command is deprecated, except for mpv-internal uses.
+
Create a named input section, or replace the contents of an already existing
input section. The ``contents`` parameter uses the same syntax as the
``input.conf`` file (except that using the section syntax in it is not
@@ -741,7 +1108,7 @@ Input Commands that are Possibly Subject to Change
information about the key state. The special key name ``unmapped`` can be
used to match any unmapped key.
-``overlay-add <id> <x> <y> <file> <offset> <fmt> <w> <h> <stride>``
+``overlay-add <id> <x> <y> <file> <offset> <fmt> <w> <h> <stride> <dw> <dh>``
Add an OSD overlay sourced from raw data. This