In FFmpeg to crop the video means to select wanted rectangular area from the input to the output without a remainder. Cropping is often used with resizing, padding and other editing
FFmpeg command to crop video
ffmpeg -i input -vf crop=iw/3:ih:0:0 output
ffmpeg -i input -vf crop=iw/3:ih:iw/3:0 output
ffmpeg -i input -vf crop=iw/3:ih:iw/3*2:0 output
FFmpeg Cropping basics
Table of FFmpeg cropping basics
Video filter: crop
Description | Crops the frames of input video to the specified width and height from the position indicated by x and y values; x and y that are the top-left corner coordinates of the output, where the center of coordination system is a top-left corner of the input video frame. If optional keep_aspect parameter is used, the output SAR (sample aspect ratio) will be changed to compensate the new DAR (display aspect ratio). |
Syntax | crop=ow[:oh[:x[:y[:keep_aspect]]]] |
x, y | computed values for x (number of pixels from top left corner horizontally) and y (number of pixels vertically), they are evaluated for every frame, default value of x is (iw – ow)/2, default value of y is (ih – oh)/2 |
in_w, iw | input width |
in_h, ih | input height |
out_w, ow | output (cropped) width, default value = iw |
out_h, oh | output (cropped) height, default value = ih |
a | aspect ratio, same as iw/ih |
sar | input sample aspect ratio |
dar | input display aspect ratio, equal to the expression a*sar |
hsub, vsub | horizontal and vertical chroma subsample values, for the pixel format yuv422p the value of hsub is 2 and vsub is 1 |
n | number of input frame, starting from 0 |
pos | position in the file of the input frame, NAN if unknown |
t | timestamp expressed in seconds, NAN if the input timestamp is unknown |
