Vapoursynth ChromaShiftF: Difference between revisions

From wiki.selur.net
Jump to navigation Jump to search
New page: ChromaShiftF (via create-page on MediaWiki MCP Server)
 
Update to current Hybrid behaviour; code as <pre> (via update-page on MediaWiki MCP Server)
 
(One intermediate revision by the same user not shown)
Line 21: Line 21:
== Example ==
== Example ==
Chroma taken from the next frame, on a progressive 10-bit YUV 4:2:0 source:
Chroma taken from the next frame, on a progressive 10-bit YUV 4:2:0 source:
<syntaxhighlight lang="python">
<pre>
# Chroma adjustment using ChromaShiftF
# Chroma adjustment using ChromaShiftF
clip = chromashift.ChromaShiftF(clip, frame_shift=1, interlaced=0)
clip = chromashift.ChromaShiftF(clip, frame_shift=1, interlaced=0)
</syntaxhighlight>
</pre>


== How Hybrid calls it ==
== How Hybrid calls it ==
Line 36: Line 36:
=== The script ===
=== The script ===
The function splits the clip into its planes, trims or pads U and V by the requested number of frames and puts the planes back together with <code>std.ShufflePlanes</code>. For interlaced clips it works on the separated fields.
The function splits the clip into its planes, trims or pads U and V by the requested number of frames and puts the planes back together with <code>std.ShufflePlanes</code>. For interlaced clips it works on the separated fields.
=== VapourSynth ===
Not a core filter; the VapourSynth documentation has no page for it.
=== AviSynth ===
The AviSynth+ documentation has no equivalent core filter; temporal chroma shifts are done there with scripts or external plugins.


== Sources ==
== Sources ==

Latest revision as of 09:47, 16 November 2026

ChromaShiftF moves the color planes in time by a few frames (or fields), for sources where the colors lag behind or run ahead of the picture.

Filtering → Vapoursynth → Color → Chroma

ChromaShiftF controls in Hybrid
ChromaShiftF controls in Hybrid

What it does

The U and V planes are taken from other frames than the luma:

  • positive values take the chroma from later frames,
  • negative values take it from earlier frames.

The missing chroma at the end (positive values) is filled with the chroma of the last frame, at the start (negative values) with the chroma of the first frame. Interlaced clips are shifted by fields instead of frames.

Settings

Control Parameter Range Hybrid default Meaning
Frames/Fields frame_shift -3 – 3 0 Number of frames (fields for interlaced clips) the chroma is moved.

Example

Chroma taken from the next frame, on a progressive 10-bit YUV 4:2:0 source:

# Chroma adjustment using ChromaShiftF
clip = chromashift.ChromaShiftF(clip, frame_shift=1, interlaced=0)

How Hybrid calls it

  • ChromaShiftF works on 8–16-bit integer YUV and takes interlaced clips directly.
  • interlaced is set from the scan type of the clip at the filter's position: 1 for top field first, -1 for bottom field first, 0 for everything else.
  • For interlaced clips the fields are separated, shifted and woven together again. This needs a frame height that splits into whole chroma rows (a multiple of 4 for 4:2:0); otherwise whole frames are shifted.
  • frame_shift is only written when it is not 0.
  • ChromaShiftF also offers the common options (Masked, ApplyOnlyTo, Merge, OnRegion, Gimmick).

Background

The script

The function splits the clip into its planes, trims or pads U and V by the requested number of frames and puts the planes back together with std.ShufflePlanes. For interlaced clips it works on the separated fields.

Sources