6

How can i use ffmpeg to crop a video

ffmpeg -i in.mp4 -filter:v "crop=500:500:20:20" Vid-out.mp4
ffmpeg -i in.mp4 -filter:v "crop=W_:H_:W_:H_"   Vid-out.mp4

what I'm trying to figure out is, how does anyone know where 500:500 is or where 20:20 is in the video or picture, where does 0 or 500 start on a picture or video, and how can i find out easily

1 Answer 1

7

Here is a diagram that might help illustrate how the crop works ( taken from FFmpeg Basics by Frantisek Korbel) :

enter image description here

1
  • In-case it's not entirely obvious (was not to me from this diagram), start with the width and height (for output), then x and y. It's a very strange notation for a rectangle, but I suppose necessary due to x and y defaulting to zero
    – MrMesees
    Feb 23, 2020 at 15:55

You must log in to answer this question.