[FFmpeg-user] Pan and scan

Michael Koch astroelectronic at t-online.de
Wed Dec 16 19:25:59 EET 2020

Am 16.12.2020 um 17:34 schrieb adam smith via ffmpeg-user:
> Hi guys,
> I am looking at turning 16x9 content into 1x1
> I want to be able to specify the source area that should be used for the output in 1 second increments and move between them smoothly.
> It looks like I could perhaps use the crop filter or the zoompan filter to achieve this.
> Does anyone have any reasons why one would be better than the other?

I think in this case it's better to use the crop filter, because it 
supports commands.

ffmpeg -i in.mp4 -lavfi sendcmd=f=coord.cmd,crop at 1=w=800:h=800:x=0:y=0 

You can specify the top left coordinates of the square window in the 
file "coord.cmd":

0.0-1.0 [expr] crop at 1 x 'lerp(0,100,TI)';
0.0-1.0 [expr] crop at 1 y 'lerp(0,100,TI)';
1.0-2.0 [expr] crop at 1 x 'lerp(100,150,TI)';
1.0-2.0 [expr] crop at 1 y 'lerp(100,220,TI)';
2.0-3.0 [expr] crop at 1 x 'lerp(150,80,TI)';
2.0-3.0 [expr] crop at 1 y 'lerp(220,220,TI)';
and so on...

In this example linear interpolation is used in the intervals.
For more info about 'sendcmd' see also chapter 2.80 in my book:


More information about the ffmpeg-user mailing list