eladg / ffmpeg-by-example

Creative Commons Attribution 4.0 International
8 stars 5 forks source link

Erratic Camera Movement Effect Using Crop Filter - FFmpeg By Example #83

Open eladg opened 2 years ago

eladg commented 2 years ago

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):

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.