The following example is based on the crop filter Examples section.
For input, we use the testsrc video generator to generate a 30s 720p video at 30 fps, and apply a crop filter to it.
The crop filter takes 4 parameters (w,h,x,y):
w: The width of the crop
h: The height of the crop
x: The x point on the width axis where the crop should start
y: The y point on the height axis where the crop should start
In this example, for the X and Y point, we use a dynamic point based on the t (timestamp) param and the sin function. Since the Sine ƒx returns a value between -1 and 1, this generates movement in the coordinates of where the x and y crop point.
https://www.ffmpegbyexample.com/examples/l97odz1t/erratic_camera_movement_effect_using_crop_filter/
The following example is based on the crop filter Examples section.
For input, we use the testsrc video generator to generate a 30s 720p video at 30 fps, and apply a
crop
filter to it.The crop filter takes 4 parameters (w,h,x,y):
w
: Thewidth
of the croph
: Theheight
of the cropx
: The x point on the width axis where the crop should starty
: The y point on the height axis where the crop should startIn this example, for the X and Y point, we use a dynamic point based on the
t
(timestamp) param and thesin
function. Since the Sine ƒx returns a value between -1 and 1, this generates movement in the coordinates of where thex
andy
crop point.