summaryrefslogtreecommitdiffstats
path: root/DOCS/man/mpv.rst
diff options
context:
space:
mode:
Diffstat (limited to 'DOCS/man/mpv.rst')
-rw-r--r--DOCS/man/mpv.rst884
1 files changed, 677 insertions, 207 deletions
diff --git a/DOCS/man/mpv.rst b/DOCS/man/mpv.rst
index 8c19906d62..579f1b313f 100644
--- a/DOCS/man/mpv.rst
+++ b/DOCS/man/mpv.rst
@@ -39,9 +39,15 @@ LIRC support - configure remotes as input devices instead).
See the ``--input-`` options for ways to customize it.
-The following listings are not necessarily complete. See ``etc/input.conf`` for
-a list of default bindings. User ``input.conf`` files and Lua scripts can
-define additional key bindings.
+The following listings are not necessarily complete. See ``etc/input.conf``
+in the mpv source files for a list of default bindings. User ``input.conf``
+files and Lua scripts can define additional key bindings.
+
+See `COMMAND INTERFACE`_ and `Key names`_ sections for more details on
+configuring keybindings.
+
+See also ``--input-test`` for interactive binding details by key, and the
+`stats`_ built-in script for key bindings list (including print to terminal).
Keyboard Control
----------------
@@ -58,7 +64,7 @@ Ctrl+LEFT and Ctrl+RIGHT
Seek to the previous/next subtitle. Subject to some restrictions and
might not always work; see ``sub-seek`` command.
-Ctrl+Shift+Left and Ctrl+Shift+Right
+Ctrl+Shift+LEFT and Ctrl+Shift+RIGHT
Adjust subtitle delay so that the next or previous subtitle is displayed
now. This is especially useful to sync subtitles to audio.
@@ -88,7 +94,7 @@ Shift+Ctrl+BACKSPACE
ENTER
Go forward in the playlist.
-p / SPACE
+p and SPACE
Pause (pressing again unpauses).
\.
@@ -104,7 +110,8 @@ q
Q
Like ``q``, but store the current playback position. Playing the same file
- later will resume at the old playback position if possible.
+ later will resume at the old playback position if possible. See
+ `RESUMING PLAYBACK`_.
/ and *
Decrease/increase volume.
@@ -121,6 +128,9 @@ m
\#
Cycle through the available audio tracks.
+E
+ Cycle through the available Editions.
+
f
Toggle fullscreen (see also ``--fs``).
@@ -134,7 +144,7 @@ w and W
Decrease/increase pan-and-scan range. The ``e`` key does the same as
``W`` currently, but use is discouraged.
-o (also P)
+o and P
Show progression bar, elapsed time and total duration on the OSD.
O
@@ -156,13 +166,16 @@ l
L
Toggle infinite looping.
-Ctrl + and Ctrl -
+Ctrl++ and Ctrl+-
Adjust audio delay (A/V sync) by +/- 0.1 seconds.
+Shift+g and Shift+f
+ Adjust subtitle font size by +/- 10%.
+
u
- Switch between applying no style overrides to SSA/ASS subtitles, and
- overriding them almost completely with the normal subtitle style. See
- ``--sub-ass-override`` for more info.
+ Switch between applying only ``--sub-ass-*`` overrides (default) to SSA/ASS
+ subtitles, and overriding them almost completely with the normal subtitle
+ style. See ``--sub-ass-override`` for more info.
V
Toggle subtitle VSFilter aspect compatibility mode. See
@@ -179,7 +192,7 @@ S
Take a screenshot, without subtitles. (Whether this works depends on VO
driver support.)
-Ctrl s
+Ctrl+s
Take a screenshot, as the window shows it (with subtitles, OSD, and scaled
video).
@@ -192,37 +205,44 @@ Shift+PGUP and Shift+PGDWN
Seek backward or forward by 10 minutes. (This used to be mapped to
PGUP/PGDWN without Shift.)
+b
+ Activate/deactivate debanding.
+
d
- Activate/deactivate deinterlacer.
+ Cycle the deinterlacing filter.
A
Cycle aspect ratio override.
-Ctrl h
+Ctrl+h
Toggle hardware video decoding on/off.
Alt+LEFT, Alt+RIGHT, Alt+UP, Alt+DOWN
Move the video rectangle (panning).
-Alt + and Alt -
- Combining ``Alt`` with the ``+`` or ``-`` keys changes video zoom.
+Alt++ and Alt+-
+ Change video zoom.
Alt+BACKSPACE
Reset the pan/zoom settings.
F8
- Show the playlist and the current position in it (useful only if a UI window
- is used, broken on the terminal).
+ Show the playlist and the current position in it.
F9
- Show the list of audio and subtitle streams (useful only if a UI window is
- used, broken on the terminal).
+ Show the list of audio and subtitle streams.
i and I
Show/toggle an overlay displaying statistics about the currently playing
file such as codec, framerate, number of dropped frames and so on. See
`STATS`_ for more information.
+DEL
+ Cycle OSC visibility between never / auto (mouse-move) / always
+
+\`
+ Show the console. (ESC closes it again. See `CONSOLE`_.)
+
(The following keys are valid only when using a video output that supports the
corresponding adjustment.)
@@ -238,16 +258,16 @@ corresponding adjustment.)
7 and 8
Adjust saturation.
-Alt+0 (and command+0 on OSX)
+Alt+0 (and Command+0 on macOS)
Resize video window to half its original size.
-Alt+1 (and command+1 on OSX)
+Alt+1 (and Command+1 on macOS)
Resize video window to its original size.
-Alt+2 (and command+2 on OSX)
+Alt+2 (and Command+2 on macOS)
Resize video window to double its original size.
-command + f (OSX only)
+Command + f (macOS only)
Toggle fullscreen (see also ``--fs``).
(The following keys are valid if you have a keyboard with multimedia keys.)
@@ -261,6 +281,8 @@ STOP
PREVIOUS and NEXT
Seek backward/forward 1 minute.
+ZOOMIN and ZOOMOUT
+ Change video zoom.
If you miss some older key bindings, look at ``etc/restore-old-bindings.conf``
in the mpv git repository.
@@ -268,12 +290,38 @@ in the mpv git repository.
Mouse Control
-------------
-button 3 and button 4
- Seek backward/forward 1 minute.
+Left double click
+ Toggle fullscreen on/off.
+
+Right click
+ Toggle pause on/off.
-button 5 and button 6
+Forward/Back button
+ Skip to next/previous entry in playlist.
+
+Wheel up/down
Decrease/increase volume.
+Wheel left/right
+ Seek forward/backward 10 seconds.
+
+Ctrl+Wheel up/down
+ Change video zoom.
+
+Context Menu
+-------------
+
+.. warning::
+
+ This feature is experimental. It may not work with all VOs. A libass based
+ fallback may be implemented in the future.
+
+Context Menu is a menu that pops up on the video window on user interaction
+(mouse right click, etc.).
+
+To use this feature, you need to fill the ``menu-data`` property with menu
+definition data, and add a keybinding to run the ``context-menu`` command,
+which can be done with a user script.
USAGE
=====
@@ -299,7 +347,7 @@ Legacy option syntax
--------------------
The ``--option=value`` syntax is not strictly enforced, and the alternative
-legacy syntax ``-option value`` and ``--option value`` will also work. This is
+legacy syntax ``-option value`` and ``-option=value`` will also work. This is
mostly for compatibility with MPlayer. Using these should be avoided. Their
semantics can change any time in the future.
@@ -309,9 +357,15 @@ because ``--fs`` is a flag option that requires no parameter. If an option
changes and its parameter becomes optional, then a command line using the
alternative syntax will break.
-Currently, the parser makes no difference whether an option starts with ``--``
-or a single ``-``. This might also change in the future, and ``--option value``
-might always interpret ``value`` as filename in order to reduce ambiguities.
+Until mpv 0.31.0, there was no difference whether an option started with ``--``
+or a single ``-``. Newer mpv releases strictly expect that you pass the option
+value after a ``=``. For example, before ``mpv --log-file f.txt`` would write
+a log to ``f.txt``, but now this command line fails, as ``--log-file`` expects
+an option value, and ``f.txt`` is simply considered a normal file to be played
+(as in ``mpv f.txt``).
+
+The future plan is that ``-option value`` will not work anymore, and options
+with a single ``-`` behave the same as ``--`` options.
Escaping spaces and other special characters
--------------------------------------------
@@ -366,6 +420,9 @@ It is started with ``%`` and has the following format::
``mpv --vf=foo:option1=%`expr length "$NAME"`%"$NAME" test.avi``
+Note: where applicable with JSON-IPC, ``%n%`` is the length in UTF-8 bytes,
+after decoding the JSON data.
+
Suboptions passed to the client API are also subject to escaping. Using
``mpv_set_option_string()`` is exactly like passing ``--name=data`` to the
command line (but without shell processing of the string). Some options
@@ -403,18 +460,32 @@ need to escape special characters. To work this around, the path can be
additionally wrapped in the fixed-length syntax, e.g. ``%n%string_of_length_n``
(see above).
-Some mpv options interpret paths starting with ``~``. Currently, the prefix
-``~~/`` expands to the mpv configuration directory (usually ``~/.config/mpv/``).
+Some mpv options interpret paths starting with ``~``.
+Currently, the prefix ``~~home/`` expands to the mpv configuration directory
+(usually ``~/.config/mpv/``).
``~/`` expands to the user's home directory. (The trailing ``/`` is always
-required.) There are the following paths as well:
+required.) The following paths are currently recognized:
================ ===============================================================
Name Meaning
================ ===============================================================
-``~~home/`` same as ``~~/``
+``~~/`` If the subpath exists in any of the mpv's config directories
+ the path of the existing file/dir is returned. Otherwise this
+ is equivalent to ``~~home/``.
+ Note that if --no-config is used ``~~/foobar`` will resolve to
+ ``foobar`` which can be unexpected.
+``~/`` user home directory root (similar to shell, ``$HOME``)
+``~~home/`` mpv config dir (for example ``~/.config/mpv/``)
``~~global/`` the global config path, if available (not on win32)
-``~~osxbundle/`` the OSX bundle resource path (OSX only)
-``~~desktop/`` the path to the desktop (win32, OSX)
+``~~osxbundle/`` the macOS bundle resource path (macOS only)
+``~~desktop/`` the path to the desktop (win32, macOS)
+``~~exe_dir/`` win32 only: the path to the directory containing the exe (for
+ config file purposes; ``$MPV_HOME`` overrides it)
+``~~cache/`` the path to application cache data (``~/.cache/mpv/``)
+ On some platforms, this will be the same as ``~~home/``.
+``~~state/`` the path to application state data (``~/.local/state/mpv/``)
+ On some platforms, this will be the same as ``~~home/``.
+``~~old_home/`` do not use
================ ===============================================================
@@ -463,79 +534,102 @@ List Options
------------
Some options which store lists of option values can have action suffixes. For
-example, you can set a ``,``-separated list of filters with ``--vf``, but the
-option also allows you to append filters with ``--vf-append``.
+example, the ``--display-tags`` option takes a ``,``-separated list of tags, but
+the option also allows you to append a single tag with ``--display-tags-append``,
+and the tag name can for example contain a literal ``,`` without the need for
+escaping.
+
+String list and path list options
+~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+
+String lists are separated by ``,``. The strings are not parsed or interpreted
+by the option system itself. However, most path or file list options use ``:``
+(Unix) or ``;`` (Windows) as separator, instead of ``,``.
-Options for filenames do not use ``,`` as separator, but ``:`` (Unix) or ``;``
-(Windows).
+They support the following operations:
============= ===============================================
Suffix Meaning
============= ===============================================
--add Append 1 or more items (may become alias for -append)
--append Append single item (avoids need for escaping)
--clr Clear the option
--del Delete an existing item by integer index
--pre Prepend 1 or more items
--set Set a list of items
--toggle Append an item, or remove if if it already exists
+-set Set a list of items (using the list separator, escaped with backslash)
+-append Append single item (does not interpret escapes)
+-add Append 1 or more items (same syntax as -set)
+-pre Prepend 1 or more items (same syntax as -set)
+-clr Clear the option (remove all items)
+-remove Delete item if present (does not interpret escapes)
+-toggle Append an item, or remove it if it already exists (no escapes)
============= ===============================================
-Although some operations allow specifying multiple ``,``-separated items, using
-this is strongly discouraged and deprecated, except for ``-set``.
+``-append`` is meant as a simple way to append a single item without having
+to escape the argument (you may still need to escape on the shell level).
-Without suffix, the action taken is normally ``-set``.
+Key/value list options
+~~~~~~~~~~~~~~~~~~~~~~
-Some options (like ``--sub-file``, ``--audio-file``, ``--glsl-shader``) are
-aliases for the proper option with ``-append`` action. For example,
-``--sub-file`` is an alias for ``--sub-files-append``.
+A key/value list is a list of key/value string pairs. In programming languages,
+this type of data structure is often called a map or a dictionary. The order
+normally does not matter, although in some cases the order might matter.
-Some options only support a subset of the above.
+They support the following operations:
-Options of this type can be changed at runtime using the ``change-list``
-command, which takes the suffix as separate operation parameter.
+============= ===============================================
+Suffix Meaning
+============= ===============================================
+-set Set a list of items (using ``,`` as separator)
+-append Append a single item (escapes for the key, no escapes for the value)
+-add Append 1 or more items (same syntax as -set)
+-remove Delete item by key if present (does not interpret escapes)
+============= ===============================================
-Playing DVDs
-------------
+Keys are unique within the list. If an already present key is set, the existing
+key is removed before the new value is appended.
+
+If you want to pass a value without interpreting it for escapes or ``,``, it is
+recommended to use the ``-append`` variant. When using libmpv, prefer using
+``MPV_FORMAT_NODE_MAP``; when using a scripting backend or the JSON IPC, use an
+appropriate structured data type.
+
+Prior to mpv 0.33, ``:`` was also recognized as separator by ``-set``.
+
+Object settings list options
+~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+
+This is a very complex option type for some options, such as ``--af`` and ``--vf``.
+They often require complicated escaping. See `VIDEO FILTERS`_ for details.
+
+They support the following operations:
+
+============= ===============================================
+Suffix Meaning
+============= ===============================================
+-set Set a list of items (using ``,`` as separator)
+-append Append single item
+-add Append 1 or more items (same syntax as -set)
+-pre Prepend 1 or more items (same syntax as -set)
+-clr Clear the option (remove all items)
+-remove Delete item if present
+-toggle Append an item, or remove it if it already exists
+-help Pseudo operation that prints a help text to the terminal
+============= ===============================================
+
+General
+~~~~~~~
+
+Without suffix, the operation used is normally ``-set``.
+
+Although some operations allow specifying multiple items, using this is strongly
+discouraged and deprecated, except for ``-set``. There is a chance that
+operations like ``-add`` and ``-pre`` will work like ``-append`` and accept a
+single, unescaped item only (so the ``,`` separator will not be interpreted and
+is passed on as part of the value).
-DVDs can be played with the ``dvd://[title]`` syntax. The optional
-title specifier is a number which selects between separate video
-streams on the DVD. If no title is given (``dvd://``) then the longest
-title is selected automatically by the library. This is usually what
-you want. mpv does not support DVD menus.
-
-DVDs which have been copied on to a hard drive or other mounted
-filesystem (by e.g. the ``dvdbackup`` tool) are accommodated by
-specifying the path to the local copy: ``--dvd-device=PATH``.
-Alternatively, running ``mpv PATH`` should auto-detect a DVD directory
-tree and play the longest title.
-
-.. note:: DVD library choices
-
- mpv uses a different default DVD library than MPlayer. MPlayer
- uses libdvdread by default, and mpv uses libdvdnav by default.
- Both libraries are developed in parallel, but libdvdnav is
- intended to support more sophisticated DVD features such as menus
- and multi-angle playback. mpv uses libdvdnav for files specified
- as either ``dvd://...`` or ``dvdnav://...``. To use libdvdread,
- which will produce behavior more like MPlayer, specify
- ``dvdread://...`` instead. Some users have experienced problems
- when using libdvdnav, in which playback gets stuck in a DVD menu
- stream. These problems are reported to go away when auto-selecting
- the title (``dvd://`` rather than ``dvd://1``) or when using
- libdvdread (e.g. ``dvdread://0``). There are also outstanding bugs
- in libdvdnav with seeking backwards and forwards in a video
- stream. Specify ``dvdread://...`` to fix such problems.
-
-.. note:: DVD subtitles
-
- DVDs use image-based subtitles. Image subtitles are implemented as
- a bitmap video stream which can be superimposed over the main
- movie. mpv's subtitle styling and positioning options and keyboard
- shortcuts generally do not work with image-based subtitles.
- Exceptions include options like ``--stretch-dvd-subs`` and
- ``--stretch-image-subs-to-screen``.
+Some options (like ``--sub-file``, ``--audio-file``, ``--glsl-shader``) are
+aliases for the proper option with ``-append`` action. For example,
+``--sub-file`` is an alias for ``--sub-files-append``.
+Options of this type can be changed at runtime using the ``change-list``
+command, which takes the suffix (without the ``-``) as separate operation
+parameter.
CONFIGURATION FILES
===================
@@ -550,30 +644,35 @@ user-specific one is ``~/.config/mpv/mpv.conf``. For details and platform
specifics (in particular Windows paths) see the `FILES`_ section.
User-specific options override system-wide options and options given on the
-command line override either. The syntax of the configuration files is
-``option=value``. Everything after a *#* is considered a comment. Options
-that work without values can be enabled by setting them to *yes* and disabled by
-setting them to *no*. Even suboptions can be specified in this way.
+command line override both. The syntax of the configuration files is
+``option=value``. Everything after a *#* is considered a comment. Options that
+work without values can be enabled by setting them to *yes* and disabled by
+setting them to *no*, and if the value is omitted, *yes* is implied. Even
+suboptions can be specified in this way.
.. admonition:: Example configuration file
::
- # Use GPU-accelerated video output by default.
- vo=gpu
- # Use quotes for text that can contain spaces:
- status-msg="Time: ${time-pos}"
+ # Don't allow new windows to be larger than the screen.
+ autofit-larger=100%x100%
+ # Enable hardware decoding if available, =yes is implied.
+ hwdec
+ # Spaces don't have to be escaped.
+ osd-playing-msg=File: ${filename}
-Escaping spaces and special characters
+Escaping special characters
--------------------------------------
-This is done like with command line options. The shell is not involved here,
-but option values still need to be quoted as a whole if it contains certain
-characters like spaces. A config entry can be quoted with ``"``,
-as well as with the fixed-length syntax (``%n%``) mentioned before. This is like
-passing the exact contents of the quoted string as command line option. C-style
-escapes are currently _not_ interpreted on this level, although some options do
-this manually. (This is a mess and should probably be changed at some point.)
+This is done like with command line options. A config entry can be quoted with
+``"``, ``'``, as well as with the fixed-length syntax (``%n%``) mentioned
+before. This is like passing the exact contents of the quoted string as a
+command line option. C-style escapes are currently _not_ interpreted on this
+level, although some options do this manually (this is a mess and should
+probably be changed at some point). The shell is not involved here, so option
+values only need to be quoted to escape ``#`` anywhere in the value, ``"``,
+``'`` or ``%`` at the beginning of the value, and leading and trailing
+whitespace.
Putting Command Line Options into the Configuration File
--------------------------------------------------------
@@ -587,7 +686,7 @@ Option Configuration file entry
``--flag`` ``flag``
``-opt val`` ``opt=val``
``--opt=val`` ``opt=val``
-``-opt "has spaces"`` ``opt="has spaces"``
+``-opt "has spaces"`` ``opt=has spaces``
======================= ========================
File-specific Configuration Files
@@ -630,47 +729,301 @@ or at runtime with the ``apply-profile <name>`` command.
# a profile that can be enabled with --profile=big-cache
[big-cache]
- cache=123400
+ cache=yes
+ demuxer-max-bytes=512MiB
demuxer-readahead-secs=20
- [slow]
- profile-desc="some profile name"
- # reference a builtin profile
- profile=gpu-hq
+ [network]
+ profile-desc="profile for content over network"
+ force-window=immediate
+ # you can also include other profiles
+ profile=big-cache
- [fast]
- vo=vdpau
+ [reduce-judder]
+ video-sync=display-resample
+ interpolation=yes
# using a profile again extends it
- [slow]
- framedrop=no
- # you can also include other profiles
- profile=big-cache
+ [network]
+ demuxer-max-back-bytes=512MiB
+ # reference a builtin profile
+ profile=fast
+
+Runtime profiles
+----------------
+Profiles can be set at runtime with ``apply-profile`` command. Since this
+operation is "destructive" (every item in a profile is simply set as an
+option, overwriting the previous value), you can't just enable and disable
+profiles again.
-Auto profiles
--------------
+As a partial remedy, there is a way to make profiles save old option values
+before overwriting them with the profile values, and then restoring the old
+values at a later point using ``apply-profile <profile-name> restore``.
-Some profiles are loaded automatically. The following example demonstrates this:
+This can be enabled with the ``profile-restore`` option, which takes one of
+the following options:
-.. admonition:: Auto profile loading
+ ``default``
+ Does nothing, and nothing can be restored (default).
+
+ ``copy``
+ When applying a profile, copy the old values of all profile options to a
+ backup before setting them from the profile. These options are reset to
+ their old values using the backup when restoring.
+
+ Every profile has its own list of backed up values. If the backup
+ already exists (e.g. if ``apply-profile name`` was called more than
+ once in a row), the existing backup is no changed. The restore operation
+ will remove the backup.
+
+ It's important to know that restoring does not "undo" setting an option,
+ but simply copies the old option value. Consider for example ``vf-add``,
+ appends an entry to ``vf``. This mechanism will simply copy the entire
+ ``vf`` list, and does _not_ execute the inverse of ``vf-add`` (that
+ would be ``vf-remove``) on restoring.
+
+ Note that if a profile contains recursive profiles (via the ``profile``
+ option), the options in these recursive profiles are treated as if they
+ were part of this profile. The referenced profile's backup list is not
+ used when creating or using the backup. Restoring a profile does not
+ restore referenced profiles, only the options of referenced profiles (as
+ if they were part of the main profile).
+
+ ``copy-equal``
+ Similar to ``copy``, but restore an option only if it has the same value
+ as the value effectively set by the profile. This tries to deal with
+ the situation when the user does not want the option to be reset after
+ interactively changing it.
+
+.. admonition:: Example
+
+ ::
+
+ [something]
+ profile-restore=copy-equal
+ vf-add=rotate=PI/2 # rotate by 90 degrees
+
+ Then running these commands will result in behavior as commented:
+
+ ::
+
+ set vf vflip
+ apply-profile something
+ vf add hflip
+ apply-profile something
+ # vf == vflip,rotate=PI/2,hflip,rotate=PI/2
+ apply-profile something restore
+ # vf == vflip
+
+Conditional auto profiles
+-------------------------
+
+Profiles which have the ``profile-cond`` option set are applied automatically
+if the associated condition matches (unless auto profiles are disabled). The
+option takes a string, which is interpreted as Lua expression. If the
+expression evaluates as truthy, the profile is applied. If the expression
+errors or evaluates as falsy, the profile is not applied. This Lua code
+execution is not sandboxed.
+
+Any variables in condition expressions can reference properties. If an
+identifier is not already defined by Lua or mpv, it is interpreted as property.
+For example, ``pause`` would return the current pause status. You cannot
+reference properties with ``-`` this way since that would denote a subtraction,
+but if the variable name contains any ``_`` characters, they are turned into
+``-``. For example, ``playback_time`` would return the property
+``playback-time``.
+
+A more robust way to access properties is using ``p.property_name`` or
+``get("property-name", default_value)``. The automatic variable to property
+magic will break if a new identifier with the same name is introduced (for
+example, if a function named ``pause()`` were added, ``pause`` would return a
+function value instead of the value of the ``pause`` property).
+
+Note that if a property is not available, it will return ``nil``, which can
+cause errors if used in expressions. These are logged in verbose mode, and the
+expression is considered to be false.
+
+Whenever a property referenced by a profile condition changes, the condition
+is re-evaluated. If the return value of the condition changes from falsy or
+error to truthy, the profile is applied.
+
+This mechanism tries to "unapply" profiles once the condition changes from
+truthy to falsy or error. If you want to use this, you need to set
+``profile-restore`` for the profile. Another possibility it to create another
+profile with an inverse condition to undo the other profile.
+
+Recursive profiles can be used. But it is discouraged to reference other
+conditional profiles in a conditional profile, since this can lead to tricky
+and unintuitive behavior.
+
+.. admonition:: Example
+
+ Make only HD video look funny:
+
+ ::
+
+ [something]
+ profile-desc=HD video sucks
+ profile-cond=width >= 1280
+ hue=-50
+
+ Make only videos containing "youtube" or "youtu.be" in their path brighter:
+
+ ::
+
+ [youtube]
+ profile-cond=path:find('youtu%.?be')
+ gamma=20
+
+ If you want the profile to be reverted if the condition goes to false again,
+ you can set ``profile-restore``:
+
+ ::
+
+ [something]
+ profile-desc=Mess up video when entering fullscreen
+ profile-cond=fullscreen
+ profile-restore=copy
+ vf-add=rotate=PI/2 # rotate by 90 degrees
+
+ This appends the ``rotate`` filter to the video filter chain when entering
+ fullscreen. When leaving fullscreen, the ``vf`` option is set to the value
+ it had before entering fullscreen. Note that this would also remove any
+ other filters that were added during fullscreen mode by the user. Avoiding
+ this is trickier, and could for example be solved by adding a second profile
+ with an inverse condition and operation:
::
- [protocol.dvd]
- profile-desc="profile for dvd:// streams"
- alang=en
+ [something]
+ profile-cond=fullscreen
+ vf-add=@rot:rotate=PI/2
+
+ [something-inv]
+ profile-cond=not fullscreen
+ vf-remove=@rot
+
+.. warning::
+
+ Every time an involved property changes, the condition is evaluated again.
+ If your condition uses ``p.playback_time`` for example, the condition is
+ re-evaluated approximately on every video frame. This is probably slow.
+
+This feature is managed by an internal Lua script. Conditions are executed as
+Lua code within this script. Its environment contains at least the following
+things:
- [extension.flv]
- profile-desc="profile for .flv files"
- vf=flip
+``(function environment table)``
+ Every Lua function has an environment table. This is used for identifier
+ access. There is no named Lua symbol for it; it is implicit.
+
+ The environment does "magic" accesses to mpv properties. If an identifier
+ is not already defined in ``_G``, it retrieves the mpv property of the same
+ name. Any occurrences of ``_`` in the name are replaced with ``-`` before
+ reading the property. The returned value is as retrieved by
+ ``mp.get_property_native(name)``. Internally, a cache of property values,
+ updated by observing the property is used instead, so properties that are
+ not observable will be stuck at the initial value forever.
+
+ If you want to access properties, that actually contain ``_`` in the name,
+ use ``get()`` (which does not perform transliteration).
+
+ Internally, the environment table has a ``__index`` meta method set, which
+ performs the access logic.
+
+``p``
+ A "magic" table similar to the environment table. Unlike the latter, this
+ does not prefer accessing variables defined in ``_G`` - it always accesses
+ properties.
+
+``get(name [, def])``
+ Read a property and return its value. If the property value is ``nil`` (e.g.
+ if the property does not exist), ``def`` is returned.
+
+ This is superficially similar to ``mp.get_property_native(name)``. An
+ important difference is that this accesses the property cache, and enables
+ the change detection logic (which is essential to the dynamic runtime
+ behavior of auto profiles). Also, it does not return an error value as
+ second return value.
+
+ The "magic" tables mentioned above use this function as backend. It does not
+ perform the ``_`` transliteration.
+
+In addition, the same environment as in a blank mpv Lua script is present. For
+example, ``math`` is defined and gives access to the Lua standard math library.
+
+.. warning::
+
+ This feature is subject to change indefinitely. You might be forced to
+ adjust your profiles on mpv updates.
+
+Legacy auto profiles
+--------------------
+
+Some profiles are loaded automatically using a legacy mechanism. The following
+example demonstrates this:
+
+.. admonition:: Auto profile loading
+
+ ::
+
+ [extension.mkv]
+ profile-desc="profile for .mkv files"
+ vf=vflip
The profile name follows the schema ``type.name``, where type can be
``protocol`` for the input/output protocol in use (see ``--list-protocols``),
and ``extension`` for the extension of the path of the currently played file
(*not* the file format).
-This feature is very limited, and there are no other auto profiles.
+This feature is very limited, and is considered soft-deprecated. Use conditional
+auto profiles.
+
+Using mpv from other programs or scripts
+========================================
+
+There are three choices for using mpv from other programs or scripts:
+
+ 1. Calling it as UNIX process. If you do this, *do not parse terminal output*.
+ The terminal output is intended for humans, and may change any time. In
+ addition, terminal behavior itself may change any time. Compatibility
+ cannot be guaranteed.
+
+ Your code should work even if you pass ``--terminal=no``. Do not attempt
+ to simulate user input by sending terminal control codes to mpv's stdin.
+ If you need interactive control, using ``--input-ipc-server`` is
+ recommended. This gives you access to the `JSON IPC`_ over unix domain
+ sockets (or named pipes on Windows).
+
+ Depending on what you do, passing ``--no-config`` or ``--config-dir`` may
+ be a good idea to avoid conflicts with the normal mpv user configuration
+ intended for CLI playback.
+
+ Using ``--input-ipc-server`` is also suitable for purposes like remote
+ control (however, the IPC protocol itself is not "secure" and not
+ intended to be so).
+
+ 2. Using libmpv. This is generally recommended when mpv is used as playback
+ backend for a completely different application. The provided C API is
+ very close to CLI mechanisms and the scripting API.
+
+ Note that even though libmpv has different defaults, it can be configured
+ to work exactly like the CLI player (except command line parsing is
+ unavailable).
+
+ See `EMBEDDING INTO OTHER PROGRAMS (LIBMPV)`_.
+
+ 3. As a user script (`LUA SCRIPTING`_, `JAVASCRIPT`_, `C PLUGINS`_). This is
+ recommended when the goal is to "enhance" the CLI player. Scripts get
+ access to the entire client API of mpv.
+
+ This is the standard way to create third-party extensions for the player.
+
+All these access the client API, which is the sum of the various mechanisms
+provided by the player core, as documented here: `OPTIONS`_,
+`List of Input Commands`_, `Properties`_, `List of events`_ (also see C API),
+`Hooks`_.
TAKING SCREENSHOTS
==================
@@ -704,8 +1057,8 @@ listed.
- ``AV:`` or ``V:`` (video only) or ``A:`` (audio only)
- The current time position in ``HH:MM:SS`` format (``playback-time`` property)
-- The total file duration (absent if unknown) (``length`` property)
-- Playback speed, e.g. `` x2.0``. Only visible if the speed is not normal. This
+- The total file duration (absent if unknown) (``duration`` property)
+- Playback speed, e.g. ``x2.0``. Only visible if the speed is not normal. This
is the user-requested speed, and not the actual speed (usually they should
be the same, unless playback is too slow). (``speed`` property.)
- Playback percentage, e.g. ``(13%)``. How much of the file has been played.
@@ -730,17 +1083,15 @@ listed.
- Dropped frames, e.g. ``Dropped: 4``. Shows up only if the count is not 0. Can
grow if the video framerate is higher than that of the display, or if video
rendering is too slow. May also be incremented on "hiccups" and when the video
- frame couldn't be displayed on time. (``vo-drop-frame-count`` property.)
+ frame couldn't be displayed on time. (``frame-drop-count`` property.)
If the decoder drops frames, the number of decoder-dropped frames is appended
to the display as well, e.g.: ``Dropped: 4/34``. This happens only if
decoder frame dropping is enabled with the ``--framedrop`` options.
- (``drop-frame-count`` property.)
-- Cache state, e.g. ``Cache: 2s+134KB``. Visible if the stream cache is enabled.
+ (``decoder-frame-drop-count`` property.)
+- Cache state, e.g. ``Cache: 2s/134KB``. Visible if the stream cache is enabled.
The first value shows the amount of video buffered in the demuxer in seconds,
- the second value shows the sum of the demuxer forward cache size and the
- *additional* data buffered in the stream cache in kilobytes.
- (``demuxer-cache-duration``, ``demuxer-cache-state``, ``cache-used``
- properties.)
+ the second value shows the estimated size of the buffered amount in kilobytes.
+ (``demuxer-cache-duration`` and ``demuxer-cache-state`` properties.)
LOW LATENCY PLAYBACK
@@ -763,7 +1114,8 @@ this with ``--untimed``, but it will likely break, unless the stream has no
audio, and the input feeds data to the player at a constant rate.
Another common problem is with MJPEG streams. These do not signal the correct
-framerate. Using ``--untimed`` or ``--no-correct-pts --fps=60`` might help.
+framerate. Using ``--untimed`` or ``--correct-pts=no --container-fps-override=60``
+might help.
For livestreams, data can build up due to pausing the stream, due to slightly
lower playback rate, or "buffering" pauses. If the demuxer cache is enabled,
@@ -781,6 +1133,33 @@ Additional options that can be tried:
- without audio ``--framedrop=no --speed=1.01`` may help for live sources
(results can be mixed)
+RESUMING PLAYBACK
+=================
+
+mpv is capable of storing the playback position of the currently playing file
+and resume from there the next time that file is played. This is done with the
+commands ``quit-watch-later`` (bound to Shift+Q by default) and
+``write-watch-later-config``, and with the ``--save-position-on-quit`` option.
+
+The difference between always quitting with a key bound to ``quit-watch-later``
+and using ``--save-position-on-quit`` is that the latter will save the playback
+position even when mpv is closed with a method other than a keybinding, such as
+clicking the close button in the window title bar. However if mpv is terminated
+abruptly and doesn't have the time to save, then the position will not be saved.
+For example, if you shutdown your system without closing mpv beforehand.
+
+mpv also stores options other than the playback position when they have been
+modified after playback began, for example the volume and selected audio/subtitles,