1. crop
  2. Crop the input video to out_w:out_h:x:y.
  3. The parameters are expressions containing the following constants:
  4. E, PI, PHI
  5. the corresponding mathematical approximated values for e (euler number), pi (greek PI), PHI (golden ratio)
  6. x, y
  7. the computed values for x and y. They are evaluated for each new frame.
  8. in_w, in_h
  9. the input width and height
  10. iw, ih
  11. same as in_w and in_h
  12. out_w, out_h
  13. the output (cropped) width and height
  14. ow, oh
  15. same as out_w and out_h
  16. n the number of input frame, starting from 0
  17. pos the position in the file of the input frame, NAN if unknown
  18. t timestamp expressed in seconds, NAN if the input timestamp is unknown
  19. The out_w and out_h parameters specify the expressions for the width and height of the output (cropped) video. They are evaluated just
  20. at the configuration of the filter.
  21. The default value of out_w is "in_w", and the default value of out_h is "in_h".
  22. The expression for out_w may depend on the value of out_h, and the expression for out_h may depend on out_w, but they cannot depend on
  23. x and y, as x and y are evaluated after out_w and out_h.
  24. The x and y parameters specify the expressions for the position of the top-left corner of the output (non-cropped) area. They are
  25. evaluated for each frame. If the evaluated value is not valid, it is approximated to the nearest valid value.
  26. The default value of x is "(in_w-out_w)/2", and the default value for y is "(in_h-out_h)/2", which set the cropped area at the center
  27. of the input image.
  28. The expression for x may depend on y, and the expression for y may depend on x.
  29. Follow some examples:
  30. # crop the central input area with size 100x100
  31. crop=100:100
  32. # crop the central input area with size 2/3 of the input video
  33. "crop=2/3*in_w:2/3*in_h"
  34. # crop the input video central square
  35. crop=in_h
  36. # delimit the rectangle with the top-left corner placed at position
  37. # 100:100 and the right-bottom corner corresponding to the right-bottom
  38. # corner of the input image.
  39. crop=in_w-100:in_h-100:100:100
  40. # crop 10 pixels from the left and right borders, and 20 pixels from
  41. # the top and bottom borders
  42. "crop=in_w-2*10:in_h-2*20"
  43. # keep only the bottom right quarter of the input image
  44. "crop=in_w/2:in_h/2:in_w/2:in_h/2"
  45. # crop height for getting Greek harmony
  46. "crop=in_w:1/PHI*in_w"
  47. # trembling effect
  48. "crop=in_w/2:in_h/2:(in_w-out_w)/2+((in_w-out_w)/2)*sin(n/10):(in_h-out_h)/2 +((in_h-out_h)/2)*sin(n/7)"
  49. # erratic camera effect depending on timestamp
  50. "crop=in_w/2:in_h/2:(in_w-out_w)/2+((in_w-out_w)/2)*sin(t*10):(in_h-out_h)/2 +((in_h-out_h)/2)*sin(t*13)"
  51. # set x depending on the value of y
  52. "crop=in_w/2:in_h/2:y:10+10*sin(n/10)"