Crop Video to 1:1 Square Center Using FFmpeg

This article provides a quick and direct guide on how to crop any landscape or portrait video into a perfect 1:1 square aspect ratio from the center using FFmpeg. You will learn the exact command-line syntax to automate this process regardless of your original video's orientation.

The Universal Command

To crop any video into a center-aligned square without needing to know the input dimensions beforehand, use the following FFmpeg command:

ffmpeg -i input.mp4 -vf "crop='min(iw,ih):min(iw,ih)'" -c:a copy output.mp4

How It Works

The core of this operation is the -vf (video filter) flag using the crop filter:

  • min(iw,ih): This expression determines the crop size. It selects the smaller of the two dimensions—input width (iw) or input height (ih)—ensuring the output is a square that fits within the original frame boundaries.
  • Width and Height: Setting both the target width and height to min(iw,ih) creates the 1:1 aspect ratio.
  • Centering: By default, if the X and Y coordinates for the crop start point are omitted, FFmpeg automatically centers the crop area.
  • -c:a copy: This option copies the audio stream directly without re-encoding it, saving processing time and preserving original audio quality.

Specific Examples

If you already know your video's orientation and prefer a simplified command, you can use these targeted options:

  • For Landscape Videos (Width is larger than Height):

    ffmpeg -i input.mp4 -vf "crop=ih:ih" -c:a copy output.mp4

    This sets both the width and height of the cropped area to the original video's height.

  • For Portrait Videos (Height is larger than Width):

    ffmpeg -i input.mp4 -vf "crop=iw:iw" -c:a copy output.mp4

    This sets both the width and height of the cropped area to the original video's width.