summaryrefslogtreecommitdiffstats
path: root/DOCS
diff options
context:
space:
mode:
authorwm4 <wm4@nowhere>2019-10-21 01:29:48 +0200
committerwm4 <wm4@nowhere>2019-10-21 01:38:25 +0200
commit5dba244c226383f9f3b15b07dfa5133ad08b6497 (patch)
tree3b6e46e9ef3350670f32a56140322980e3b37954 /DOCS
parent8a4e9d5c180157684546db4c1235d8c958172ca9 (diff)
downloadmpv-5dba244c226383f9f3b15b07dfa5133ad08b6497.tar.bz2
mpv-5dba244c226383f9f3b15b07dfa5133ad08b6497.tar.xz
filters: extend vf_format so that it can convert color parameters
Form some reason (and because of my fault), vf_format converts image formats, but nothing else. For example, setting the "colormatrix" sub-parameter would not convert it to the new value, but instead overwrite the metadata (basically "reinterpreting" the image data without changing it). Make the historical mistake worse, and go all the way and extend it such that it can perform a conversion. For compatibility reasons, this needs to be requested explicitly. (Maybe this would deserve a separate filter to begin with, but things are messed up anyway. Feel free to suggest an elegant and simple solution.) This demonstrates how zimg can properly perform some conversions which swscale cannot (see examples added to vf.rst). Stupidly this requires 2 code paths, one for conversion, and one for overriding the parameters. Due to the filter bullshit (what was I thinking), this requires quite some acrobatics that would not be necessary without these abstractions. On the other hand, it'd definitely be more of a mess without it. Oh whatever.
Diffstat (limited to 'DOCS')
-rw-r--r--DOCS/man/vf.rst48
1 files changed, 44 insertions, 4 deletions
diff --git a/DOCS/man/vf.rst b/DOCS/man/vf.rst
index ac87cb26fc..350f1b7182 100644
--- a/DOCS/man/vf.rst
+++ b/DOCS/man/vf.rst
@@ -112,15 +112,55 @@ With filters that support it, you can access parameters by their name.
Available mpv-only filters are:
``format=fmt=<value>:colormatrix=<value>:...``
- Restricts the color space for the next filter without doing any conversion.
- Use together with the scale filter for a real conversion.
+ Applies video parameter overrides, with optional conversion. By default,
+ this
.. note::
- For a list of available formats, see ``format=fmt=help``.
+ For a list of available formats, use ``--vf=format=fmt=help``.
``<fmt>``
- Format name, e.g. rgb15, bgr24, 420p, etc. (default: don't change).
+ Image format name, e.g. rgb15, bgr24, 420p, etc. (default: don't change).
+
+ This filter always performs conversion to the given format.
+
+ ``<convert=yes|no>``
+ Force conversion of color parameters (default: no).
+
+ If this is disabled (the default), the only conversion that is possibly
+ performed is format conversion if ``<fmt>`` is set. All other parameters
+ (like ``<colormatrix>``) are forced without conversion. This mode is
+ typically useful when files have been incorrectly tagged.
+
+ If this is enabled, libswscale or zimg is used if any of the parameters
+ mismatch. zimg is used of the input/output image formats are supported
+ by mpv's zimg wrapper, and if ``--sws-allow-zimg=yes`` is used. Both
+ libraries may not support all kinds of conversions. This typically
+ results in silent incorrect conversion. zimg has in many cases a better
+ chance of performing the conversion correctly.
+
+ In both cases, the color parameters are set on the output stage of the
+ image format conversion (if ``fmt`` was set). The difference is that
+ with ``convert=no``, the color parameters are not passed on to the
+ converter.
+
+ If input and output video parameters are the same, conversion is always
+ skipped.
+
+ .. admonition:: Examples
+
+ ``mpv test.mkv --vf=format:colormatrix=ycgco``
+ Results in incorrect colors (if test.mkv was tagged correctly).
+
+ ``mpv test.mkv --vf=format:colormatrix=ycgco:convert=yes --sws-allow-zimg``
+ Results in true conversion to ``ycgco``, assuming the renderer
+ supports it (``--vo=gpu`` normally does). You can add ``--vo=xv``
+ to force a VO which definitely does not support it, which should
+ show incorrect colors as confirmation.
+
+ Using ``--sws-allow-zimg=no`` (or disabling zimg at build time)
+ will use libswscale, which cannot perform this conversion as
+ of this writing.
``<colormatrix>``
Controls the YUV to RGB color space conversion when playing video. There