Keyboard shortcuts

Press or to navigate between chapters

Press S or / to search in the book

Press ? to show this help

Press Esc to hide this help

crop

crop(
  input: Clip,
  #{
    left?: Int,
    top?: Int,
    width?: Int,
    height?: Int,
    right?: Int,
    bottom?: Int,
  }
)

Returns a rectangular view of one clip without changing its format or timing.

The input must be one fixed-format, fixed-resolution planar Gray, YUV, or planar RGB clip. left, top, right, and bottom must be non-negative. width and height must be positive when supplied. Use exactly one of width and right, and exactly one of height and bottom. The crop rectangle must stay inside the source frame. For subsampled YUV formats, all crop edges must also stay aligned to the chroma plane divisors.

Examples

output = source("input.mkv").std.crop(#{ left: 0, top: 0, width: 1280, height: 720 })
output = source("input.mkv").std.crop(#{ left: 8, top: 4, right: 8, bottom: 4 })

Input

One fixed-format, fixed-resolution planar Gray, YUV, or planar RGB clip.

Output

A clip with the same format, timing, and metadata, cropped to the requested rectangle.

Options

  • left (Int, default: 0) – Set the left crop offset in full-resolution pixels.
  • top (Int, default: 0) – Set the top crop offset in full-resolution pixels.
  • width (Int) – Set the cropped output width. Mutually exclusive with right.
  • height (Int) – Set the cropped output height. Mutually exclusive with bottom.
  • right (Int) – Set the number of full-resolution pixels to crop from the right side. Mutually exclusive with width.
  • bottom (Int) – Set the number of full-resolution pixels to crop from the bottom side. Mutually exclusive with height.