Infery.ai
← All tools

Crop video frame

Video

video.crop

in: videoout: video

Crop video frame to a rectangle.

Pricing

Price
6.25 cr / second

Prices in credits (1 credit = $0.01).

Crop Video Frame

Crop the video frame to a rectangular region, discarding everything outside it.

When to use

  • Remove black bars from letterboxed or pillarboxed recordings.
  • Focus on a region of interest within the frame.
  • Square crop for social media formats.

Inputs & outputs

Input modalityVideo file (URL)
Output modalityVideo file (GCS URL)
Max input duration30 min
Max input size5 GB

Parameters

ParamRequiredDescription
xyesLeft edge of the crop rectangle in pixels (non-negative)
yyesTop edge of the crop rectangle in pixels (non-negative)
widthyesWidth of the crop rectangle in pixels (positive)
heightyesHeight of the crop rectangle in pixels (positive)

All coordinates are relative to the top-left corner of the original frame.

Examples

Center crop to 640×480 from a 960×540 video

{
  "type": "video.crop",
  "input": { "video_url": "gs://infery-prod-media/example/input.mp4" },
  "params": { "x": 160, "y": 30, "width": 640, "height": 480 }
}

Remove 20px border on all sides from a 1280×720 video

{
  "type": "video.crop",
  "input": { "video_url": "gs://infery-prod-media/example/input.mp4" },
  "params": { "x": 20, "y": 20, "width": 1240, "height": 680 }
}

Related capabilities

  • video.scale — resize after cropping to hit an exact output resolution
  • video.watermark — overlay a logo on the cropped result
  • video.pipeline — chain crop with scale and transcode in one step

Examples

Center crop 640×480

{
  "x": 160,
  "y": 60,
  "width": 640,
  "height": 480
}