<?xml version="1.0"?>
<feed xmlns="http://www.w3.org/2005/Atom" xml:lang="en">
	<id>https://wiki.selur.net/index.php?action=history&amp;feed=atom&amp;title=Vapoursynth_ColorMatrix</id>
	<title>Vapoursynth ColorMatrix - Revision history</title>
	<link rel="self" type="application/atom+xml" href="https://wiki.selur.net/index.php?action=history&amp;feed=atom&amp;title=Vapoursynth_ColorMatrix"/>
	<link rel="alternate" type="text/html" href="https://wiki.selur.net/index.php?title=Vapoursynth_ColorMatrix&amp;action=history"/>
	<updated>2026-11-19T06:10:43Z</updated>
	<subtitle>Revision history for this page on the wiki</subtitle>
	<generator>MediaWiki 1.46.2</generator>
	<entry>
		<id>https://wiki.selur.net/index.php?title=Vapoursynth_ColorMatrix&amp;diff=489&amp;oldid=prev</id>
		<title>Selur: Update to current Hybrid behaviour; code as &lt;pre&gt; (via update-page on MediaWiki MCP Server)</title>
		<link rel="alternate" type="text/html" href="https://wiki.selur.net/index.php?title=Vapoursynth_ColorMatrix&amp;diff=489&amp;oldid=prev"/>
		<updated>2026-11-16T08:48:22Z</updated>

		<summary type="html">&lt;p&gt;Update to current Hybrid behaviour; code as &amp;lt;pre&amp;gt; (via update-page on MediaWiki MCP Server)&lt;/p&gt;
&lt;table style=&quot;background-color: #fff; color: #202122;&quot; data-mw-interface=&quot;&quot;&gt;
				&lt;col class=&quot;diff-marker&quot; /&gt;
				&lt;col class=&quot;diff-content&quot; /&gt;
				&lt;col class=&quot;diff-marker&quot; /&gt;
				&lt;col class=&quot;diff-content&quot; /&gt;
				&lt;tr class=&quot;diff-title&quot; lang=&quot;en&quot;&gt;
				&lt;td colspan=&quot;2&quot; style=&quot;background-color: #fff; color: #202122; text-align: center;&quot;&gt;← Older revision&lt;/td&gt;
				&lt;td colspan=&quot;2&quot; style=&quot;background-color: #fff; color: #202122; text-align: center;&quot;&gt;Revision as of 09:48, 16 November 2026&lt;/td&gt;
				&lt;/tr&gt;&lt;tr&gt;&lt;td colspan=&quot;2&quot; class=&quot;diff-lineno&quot; id=&quot;mw-diff-left-l26&quot;&gt;Line 26:&lt;/td&gt;
&lt;td colspan=&quot;2&quot; class=&quot;diff-lineno&quot;&gt;Line 26:&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class=&quot;diff-marker&quot;&gt;&lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;== Example ==&lt;/div&gt;&lt;/td&gt;&lt;td class=&quot;diff-marker&quot;&gt;&lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;== Example ==&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class=&quot;diff-marker&quot;&gt;&lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;A BT.709 clip converted to BT.601 (470bg) for SD output, 10-bit, with the default clipping:&lt;/div&gt;&lt;/td&gt;&lt;td class=&quot;diff-marker&quot;&gt;&lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;A BT.709 clip converted to BT.601 (470bg) for SD output, 10-bit, with the default clipping:&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class=&quot;diff-marker&quot; data-marker=&quot;−&quot;&gt;&lt;/td&gt;&lt;td style=&quot;color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #ffe49c; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;&amp;lt;&lt;del style=&quot;font-weight: bold; text-decoration: none;&quot;&gt;syntaxhighlight lang=&quot;python&quot;&lt;/del&gt;&amp;gt;&lt;/div&gt;&lt;/td&gt;&lt;td class=&quot;diff-marker&quot; data-marker=&quot;+&quot;&gt;&lt;/td&gt;&lt;td style=&quot;color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #a3d3ff; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;&amp;lt;&lt;ins style=&quot;font-weight: bold; text-decoration: none;&quot;&gt;pre&lt;/ins&gt;&amp;gt;&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class=&quot;diff-marker&quot;&gt;&lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;# ColorMatrix: adjusting color matrix from 709 to 470bg&lt;/div&gt;&lt;/td&gt;&lt;td class=&quot;diff-marker&quot;&gt;&lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;# ColorMatrix: adjusting color matrix from 709 to 470bg&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class=&quot;diff-marker&quot;&gt;&lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;# ColorMatrix: clipping to TV levels&lt;/div&gt;&lt;/td&gt;&lt;td class=&quot;diff-marker&quot;&gt;&lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;# ColorMatrix: clipping to TV levels&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td colspan=&quot;2&quot; class=&quot;diff-lineno&quot; id=&quot;mw-diff-left-l34&quot;&gt;Line 34:&lt;/td&gt;
&lt;td colspan=&quot;2&quot; class=&quot;diff-lineno&quot;&gt;Line 34:&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class=&quot;diff-marker&quot;&gt;&lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;# ColorMatrix: clipping to TV levels&lt;/div&gt;&lt;/td&gt;&lt;td class=&quot;diff-marker&quot;&gt;&lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;# ColorMatrix: clipping to TV levels&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class=&quot;diff-marker&quot;&gt;&lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;clip = core.std.Limiter(clip=clip, min=[64, 64, 64], max=[940, 960, 960])&lt;/div&gt;&lt;/td&gt;&lt;td class=&quot;diff-marker&quot;&gt;&lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;clip = core.std.Limiter(clip=clip, min=[64, 64, 64], max=[940, 960, 960])&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class=&quot;diff-marker&quot; data-marker=&quot;−&quot;&gt;&lt;/td&gt;&lt;td style=&quot;color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #ffe49c; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;&amp;lt;/&lt;del style=&quot;font-weight: bold; text-decoration: none;&quot;&gt;syntaxhighlight&lt;/del&gt;&amp;gt;&lt;/div&gt;&lt;/td&gt;&lt;td class=&quot;diff-marker&quot; data-marker=&quot;+&quot;&gt;&lt;/td&gt;&lt;td style=&quot;color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #a3d3ff; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;&amp;lt;/&lt;ins style=&quot;font-weight: bold; text-decoration: none;&quot;&gt;pre&lt;/ins&gt;&amp;gt;&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class=&quot;diff-marker&quot;&gt;&lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;br&gt;&lt;/td&gt;&lt;td class=&quot;diff-marker&quot;&gt;&lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;br&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class=&quot;diff-marker&quot;&gt;&lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;== How Hybrid calls it ==&lt;/div&gt;&lt;/td&gt;&lt;td class=&quot;diff-marker&quot;&gt;&lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;== How Hybrid calls it ==&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;/table&gt;</summary>
		<author><name>Selur</name></author>
	</entry>
	<entry>
		<id>https://wiki.selur.net/index.php?title=Vapoursynth_ColorMatrix&amp;diff=127&amp;oldid=prev</id>
		<title>Selur: New page: ColorMatrix (via create-page on MediaWiki MCP Server)</title>
		<link rel="alternate" type="text/html" href="https://wiki.selur.net/index.php?title=Vapoursynth_ColorMatrix&amp;diff=127&amp;oldid=prev"/>
		<updated>2026-11-14T17:58:01Z</updated>

		<summary type="html">&lt;p&gt;New page: ColorMatrix (via create-page on MediaWiki MCP Server)&lt;/p&gt;
&lt;p&gt;&lt;b&gt;New page&lt;/b&gt;&lt;/p&gt;&lt;div&gt;&amp;lt;div style=&amp;quot;float:right; margin:0 0 1em 1em;&amp;quot;&amp;gt;__TOC__&amp;lt;/div&amp;gt;&lt;br /&gt;
&amp;#039;&amp;#039;&amp;#039;ColorMatrix&amp;#039;&amp;#039;&amp;#039; converts YUV video from one set of YUV↔RGB coefficients (the color matrix, e.g. BT.709 or BT.601) to another, directly in YUV. Use it when the target needs another matrix than the source, for example when HD material (BT.709) is turned into SD (BT.601), or when the source was encoded with a different matrix than it is flagged with.&lt;br /&gt;
&lt;br /&gt;
&amp;#039;&amp;#039;Filtering → Vapoursynth → Color → Conversion&amp;#039;&amp;#039;&lt;br /&gt;
&lt;br /&gt;
[[File:Vapoursynth_ColorMatrix.png|none|ColorMatrix controls in Hybrid]]&lt;br /&gt;
&lt;br /&gt;
== What it does ==&lt;br /&gt;
The picture is converted from the &amp;#039;&amp;#039;From&amp;#039;&amp;#039; matrix to the &amp;#039;&amp;#039;To&amp;#039;&amp;#039; matrix with VapourSynth&amp;#039;s resize, so that the colors look the same after decoding with the new matrix. Format, bit depth and range stay as they are. ColorMatrix changes neither the primaries nor the transfer characteristic; it is not a tone mapper.&lt;br /&gt;
&lt;br /&gt;
== Settings ==&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
! Control !! Parameter !! Values !! Hybrid default !! Meaning&lt;br /&gt;
|-&lt;br /&gt;
| From || matrix_in_s || Rec.709, FCC, Rec.601/470bg/470m, SMPTE 170m, SMPTE 240m, YCgCo, Rec.2020ncl, Rec.2020cl, Chroma ncl, Chroma cl || matrix of the source || Matrix the clip is converted from. While the filter is off it follows the source&amp;#039;s matrix; change it when the source is flagged wrongly.&lt;br /&gt;
|-&lt;br /&gt;
| To || matrix_s || same list || SMPTE 170m || Matrix the clip is converted to. Disabled while &amp;#039;&amp;#039;Adjust by resolution&amp;#039;&amp;#039; is on.&lt;br /&gt;
|-&lt;br /&gt;
| Adjust by resolution || – || on/off || on || Picks &amp;#039;&amp;#039;To&amp;#039;&amp;#039; from the output resolution: Rec.601/470bg up to 720×576, Rec.709 up to 1920×1088, Rec.2020ncl above.&lt;br /&gt;
|-&lt;br /&gt;
| Transfer || _Transfer || BT.709, BT.470 System M, BT.470 System B/G, BT.601, SMPTE 240M, Linear, Log (100:1), Log (316.22777:1), xvYCC, sRGB, BT.2020 (10-bit), BT.2020 (12-bit), PQ, HLG || BT.709 || Transfer characteristic of the clip; only used (and enabled) when &amp;#039;&amp;#039;From&amp;#039;&amp;#039; or &amp;#039;&amp;#039;To&amp;#039;&amp;#039; is a 2020 or Chroma matrix, which depend on it.&lt;br /&gt;
|-&lt;br /&gt;
| Clipping || – || no clipping, pre clipping, post clipping, pre and post clipping || pre and post clipping || Limits luma to 16–235 and chroma to 16–240 (8-bit scale, scaled to the bit depth) before, after, or before and after the conversion.&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
== Example ==&lt;br /&gt;
A BT.709 clip converted to BT.601 (470bg) for SD output, 10-bit, with the default clipping:&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;python&amp;quot;&amp;gt;&lt;br /&gt;
# ColorMatrix: adjusting color matrix from 709 to 470bg&lt;br /&gt;
# ColorMatrix: clipping to TV levels&lt;br /&gt;
clip = core.std.Limiter(clip=clip, min=[64, 64, 64], max=[940, 960, 960])&lt;br /&gt;
clip = core.std.RemoveFrameProps(clip=clip, props=[&amp;quot;_Matrix&amp;quot;])&lt;br /&gt;
clip = core.resize.Bicubic(clip, matrix_in_s=&amp;quot;709&amp;quot;, matrix_s=&amp;quot;470bg&amp;quot;)&lt;br /&gt;
# ColorMatrix: clipping to TV levels&lt;br /&gt;
clip = core.std.Limiter(clip=clip, min=[64, 64, 64], max=[940, 960, 960])&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== How Hybrid calls it ==&lt;br /&gt;
* ColorMatrix works on every YUV format and keeps it.&lt;br /&gt;
* Nothing is written when &amp;#039;&amp;#039;From&amp;#039;&amp;#039; and &amp;#039;&amp;#039;To&amp;#039;&amp;#039; are the same matrix.&lt;br /&gt;
* VapourSynth&amp;#039;s resize ignores &amp;#039;&amp;#039;matrix_in_s&amp;#039;&amp;#039; while the clip carries a matrix frame property, so Hybrid removes that property right before the conversion; resize sets the new one.&lt;br /&gt;
* For 2020 and Chroma matrices the chosen transfer is written as frame property before the conversion.&lt;br /&gt;
* The resizer kernel is the one chosen as &amp;#039;&amp;#039;Color resizer&amp;#039;&amp;#039; in Hybrid&amp;#039;s Vapoursynth settings (Bicubic by default).&lt;br /&gt;
* After the filter Hybrid uses &amp;#039;&amp;#039;To&amp;#039;&amp;#039; as the clip&amp;#039;s matrix for all following conversions.&lt;br /&gt;
* Switching on [[Vapoursynth HDR10ToSDR|HDR10ToSDR]] or [[Vapoursynth HDR10 to SDR (DG)|HDR10 to SDR (DG)]] switches ColorMatrix off, and the other way round.&lt;br /&gt;
* ColorMatrix also offers the [[Vapoursynth common filter options|common options]] (Masked, ApplyOnlyTo, Merge, OnRegion, Gimmick).&lt;br /&gt;
&lt;br /&gt;
== Background ==&lt;br /&gt;
=== VapourSynth (resize) ===&lt;br /&gt;
The core resizers convert between formats and color spaces with the zimg library. &amp;#039;&amp;#039;matrix_in_s&amp;#039;&amp;#039;/&amp;#039;&amp;#039;matrix_s&amp;#039;&amp;#039; name the coefficients (709, fcc, 470bg, 170m, 240m, ycgco, 2020ncl, 2020cl, chromancl, chromacl, ictcp). The documentation notes that the &amp;#039;&amp;#039;_in&amp;#039;&amp;#039; arguments only apply when the matching frame property is unset, and that resize does not clip: values outside the legal range can remain, which is why Hybrid clips with &amp;lt;code&amp;gt;std.Limiter&amp;lt;/code&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
=== AviSynth ===&lt;br /&gt;
AviSynth+ converts between matrices with ConvertToYUV…/ConvertToRGB… and their &amp;#039;&amp;#039;matrix&amp;#039;&amp;#039; parameter; a direct YUV-to-YUV matrix change is done with the external ColorMatrix plugin. See [[Avisynth ColorMatrix]].&lt;br /&gt;
&lt;br /&gt;
== Sources ==&lt;br /&gt;
* [https://www.vapoursynth.com/doc/functions/video/resize.html VapourSynth documentation: resize]&lt;br /&gt;
* [https://www.vapoursynth.com/doc/functions/video/limiter.html VapourSynth documentation: std.Limiter]&lt;br /&gt;
* [https://avisynthplus.readthedocs.io/en/latest/avisynthdoc/corefilters/convert.html AviSynth+ documentation: Convert]&lt;br /&gt;
* Hybrid&amp;#039;s tooltips&lt;br /&gt;
&lt;br /&gt;
[[Category:Vapoursynth Filters]]&lt;/div&gt;</summary>
		<author><name>Selur</name></author>
	</entry>
</feed>