Vapoursynth ChromaShiftF

From wiki.selur.net
Revision as of 19:35, 14 November 2026 by Selur (talk | contribs) (Remove background without information (via update-page on MediaWiki MCP Server))
Jump to navigation Jump to search

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