Vapoursynth Limiter: Difference between revisions
Contents box on the right, new section order (via update-page on MediaWiki MCP Server) |
Example: before/after slider (via update-page on MediaWiki MCP Server) |
||
| (2 intermediate revisions by the same user not shown) | |||
| Line 28: | Line 28: | ||
== Example == | == Example == | ||
Default settings (''Use RGB'' on) on a 10-bit YUV 4:2:0 source: | Default settings (''Use RGB'' on) on a 10-bit YUV 4:2:0 source: | ||
< | <pre> | ||
# adjusting color space from YUV420P10 to RGB30 for vsLimiter | # adjusting color space from YUV420P10 to RGB30 for vsLimiter | ||
clip = core.resize.Bicubic(clip=clip, format=vs.RGB30, matrix_in_s="470bg", range_in_s="limited", range_s="full") | clip = core.resize.Bicubic(clip=clip, format=vs.RGB30, matrix_in_s="470bg", range_in_s="limited", range_s="full") | ||
| Line 35: | Line 35: | ||
# adjusting output color from RGB30 to YUV420P10 for NVEncModel | # adjusting output color from RGB30 to YUV420P10 for NVEncModel | ||
clip = core.resize.Bicubic(clip=clip, format=vs.YUV420P10, matrix_s="470bg", range_in_s="full", range_s="limited") | clip = core.resize.Bicubic(clip=clip, format=vs.YUV420P10, matrix_s="470bg", range_in_s="full", range_s="limited") | ||
</ | </pre> | ||
Before and after (drag the handle to compare), with this call: | |||
<pre> | |||
# adjusting color using Limiter | |||
clip = core.vszip.Limiter(clip=clip, min=[16,16,16], max=[235,235,235]) | |||
</pre> | |||
{{#imageslider:Image1=File:Vapoursynth_Limiter_before.png|Image2=File:Vapoursynth_Limiter_after.png|width=960px}} | |||
== How Hybrid calls it == | == How Hybrid calls it == | ||
* The limits are entered on the 8-bit scale. Hybrid scales them to the clip's bit depth: 255 becomes the format's maximum (1023 at 10 bit, 65535 at 16 bit), other values are shifted (16 becomes 64 at 10 bit). For 32-bit float RGB they are divided by 255. | * The limits are entered on the 8-bit scale. Hybrid scales them to the clip's bit depth: 255 becomes the format's maximum (1023 at 10 bit, 65535 at 16 bit), other values are shifted (16 becomes 64 at 10 bit). For 32-bit float RGB they are divided by 255; for 32-bit float YUV Hybrid writes one value per plane: luma divided by 255, chroma centered on 0 ((value − 128) / 255). | ||
* With ''Use RGB'' Hybrid converts the clip to RGB first, if it isn't RGB already; all three planes are processed. | * With ''Use RGB'' Hybrid converts the clip to RGB first, if it isn't RGB already; all three planes are processed. | ||
* Without ''Use RGB'' the filter runs in YUV and ''Planes'' decides which planes are touched. Anything but ''luma only'' gives unexpected results in YUV; Hybrid writes a warning comment into the script in that case. | * Without ''Use RGB'' the filter runs in YUV and ''Planes'' decides which planes are touched. Anything but ''luma only'' gives unexpected results in YUV; Hybrid writes a warning comment into the script in that case. | ||
Latest revision as of 16:28, 16 November 2026
Limiter clamps every pixel value into a range: values below min are raised to min, values above max are lowered to max. Unlike Levels it does not stretch or remap anything, it only clips.
Filtering → Vapoursynth → Color → Levels

What it does
Typical uses:
- keep values within broadcast-legal limits, for example 16–235,
- cut off overshoots that earlier filters (sharpeners, resizers) left behind.
Settings
| Control | Parameter | Range | Hybrid default | Meaning |
|---|---|---|---|---|
| Limits (min/max) | min / max | 0–255 | 0 / 255 | Range all values are clamped to, on the 8-bit scale. |
| Planes | planes | all, chroma only, luma only | luma only | Planes that are processed; the others are copied unchanged. Only used without Use RGB. |
| Use RGB | – | on/off | on | Converts to RGB before filtering, so all three color channels are clamped. |
| Range signaling | – | unchanged, full, limited | unchanged | Overwrites the clip's color range flag before the filter. |
| Tools: Limiter | – | vszip, std, tune | vszip | Implementation: vszip's Limiter, VapourSynth's built-in std.Limiter, or tune (the faster one according to Hybrid's tools benchmark). |
Example
Default settings (Use RGB on) on a 10-bit YUV 4:2:0 source:
# adjusting color space from YUV420P10 to RGB30 for vsLimiter clip = core.resize.Bicubic(clip=clip, format=vs.RGB30, matrix_in_s="470bg", range_in_s="limited", range_s="full") # adjusting color using Limiter clip = core.vszip.Limiter(clip=clip, min=[0,0,0], max=[1023,1023,1023]) # adjusting output color from RGB30 to YUV420P10 for NVEncModel clip = core.resize.Bicubic(clip=clip, format=vs.YUV420P10, matrix_s="470bg", range_in_s="full", range_s="limited")
Before and after (drag the handle to compare), with this call:
# adjusting color using Limiter clip = core.vszip.Limiter(clip=clip, min=[16,16,16], max=[235,235,235])
How Hybrid calls it
- The limits are entered on the 8-bit scale. Hybrid scales them to the clip's bit depth: 255 becomes the format's maximum (1023 at 10 bit, 65535 at 16 bit), other values are shifted (16 becomes 64 at 10 bit). For 32-bit float RGB they are divided by 255; for 32-bit float YUV Hybrid writes one value per plane: luma divided by 255, chroma centered on 0 ((value − 128) / 255).
- With Use RGB Hybrid converts the clip to RGB first, if it isn't RGB already; all three planes are processed.
- Without Use RGB the filter runs in YUV and Planes decides which planes are touched. Anything but luma only gives unexpected results in YUV; Hybrid writes a warning comment into the script in that case.
- Limiter also offers the common options (Masked, ApplyOnlyTo, Merge, OnRegion, Gimmick).
Background
VapourSynth (std.Limiter)
std.Limiter(clip, min, max, planes) clamps samples into [min, max]. It accepts 8–16 bit integer and 32-bit float clips. min and max default to the lowest and highest legal value of the format and can be given per plane; planes that are not selected are copied unchanged.
vszip (Limiter)
vszip's Limiter is a faster version of std.Limiter with the same min, max and planes parameters. It also has tv_range (limited-range defaults) and mask (float chroma range), which Hybrid does not use.
AviSynth (Limiter)
AviSynth's Limiter takes separate luma and chroma limits and by default clamps to CCIR-601 levels (luma 16–235, chroma 16–240). With paramscale the limits are given on the 8-bit scale and scaled to the bit depth; a show mode highlights out-of-range pixels instead of clipping them.
Sources
- VapourSynth documentation: std.Limiter
- vapoursynth-zip README and its Limiter wiki page
- AviSynth+ documentation: Limiter
- Hybrid's tooltips