Vapoursynth Tweak: Difference between revisions

From wiki.selur.net
Jump to navigation Jump to search
Remove background without information (via update-page on MediaWiki MCP Server)
Update to current Hybrid behaviour; code as <pre> (via update-page on MediaWiki MCP Server)
 
Line 30: Line 30:
== Example ==
== Example ==
Saturation 1.20 and brightness +10 on a 10-bit YUV 4:2:0 source:
Saturation 1.20 and brightness +10 on a 10-bit YUV 4:2:0 source:
<syntaxhighlight lang="python">
<pre>
# adjusting color using Tweak
# adjusting color using Tweak
clip = color.Tweak(clip, hue=0.00, sat=1.20, cont=1.00, bright=40, coring=True, tools={'expr': 'akarin'})
clip = color.Tweak(clip, hue=0.00, sat=1.20, cont=1.00, bright=40, coring=True, tools={'expr': 'akarin'})
</syntaxhighlight>
</pre>


== How Hybrid calls it ==
== How Hybrid calls it ==

Latest revision as of 09:52, 16 November 2026

Tweak adjusts hue, saturation, brightness and contrast of a YUV clip. It is a port of AviSynth's Tweak filter.

Filtering → Vapoursynth → Color → Grading

Tweak controls in Hybrid
Tweak controls in Hybrid

What it does

  • Hue and Saturation rotate and scale the two chroma planes around the neutral gray.
  • Brightness and Contrast change the luma plane only.
  • Coring keeps the result inside TV (limited) range.

Settings

Control Parameter Range Hybrid default Meaning
Hue hue -180 – 180 0.00 Rotates the colors by this many degrees; positive towards red, negative towards green.
Saturation sat 0 – 10 1.00 > 1 more color, < 1 less color, 0 = grayscale.
Brightness bright -255 – 255 0 Offset added to luma, on the 8-bit scale.
Contrast cont 0 – 10 1.00 Multiplies luma.
Coring coring on/off on Clamps the output to TV range (luma 16–235, chroma 16–240); contrast then scales around 16 instead of 0.
Tools: Expr tools akarin, cranexpr, std akarin (std without AVX2) Expression evaluator used inside the script.

Example

Saturation 1.20 and brightness +10 on a 10-bit YUV 4:2:0 source:

# adjusting color using Tweak
clip = color.Tweak(clip, hue=0.00, sat=1.20, cont=1.00, bright=40, coring=True, tools={'expr': 'akarin'})

How Hybrid calls it

  • Tweak works on YUV clips; an RGB clip is converted to YUV first.
  • Brightness is entered on the 8-bit scale and scaled to the clip's bit depth (+10 becomes +40 at 10 bit); for float clips it is divided by 255. It is only written when it is not 0.
  • Hue, Saturation, Contrast and Coring are always written.
  • On 32-bit float clips Coring has no effect and contrast scales around 0.
  • Tweak also offers the common options (Masked, ApplyOnlyTo, Merge, OnRegion, Gimmick).

Background

The script

The VapourSynth version is a script function based on dubhater's adjust. Chroma is processed with one expression per plane (rotation by hue, scaling by saturation around the neutral value, then clamping); luma with a lookup table for integer clips or an expression for float clips. Gray clips skip hue and saturation.

vapoursynth-adjust

adjust describes itself as a very basic port of AviSynth's Tweak, built on std.Lut and std.Expr: Tweak(clip, hue=0.0, sat=1.0, bright=0.0, cont=1.0, coring=True) for 8–16 bit integer and 32-bit float clips. It has no dithering and none of AviSynth's hue/saturation range options.

AviSynth (Tweak)

AviSynth's Tweak has the same five main parameters with the same defaults and ranges, scaled automatically to every bit depth. On top it can restrict the change to a hue arc (startHue/endHue) or a saturation band (minSat/maxSat) with a soft edge (interp), and offers dithering. See Avisynth Tweak.

Sources