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? Thanks Adam
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@1=w=800:h=800:x=0:y=0 out.mp4 You can specify the top left coordinates of the square window in the file "coord.cmd": 0.0-1.0 [expr] crop@1 x 'lerp(0,100,TI)'; 0.0-1.0 [expr] crop@1 y 'lerp(0,100,TI)'; 1.0-2.0 [expr] crop@1 x 'lerp(100,150,TI)'; 1.0-2.0 [expr] crop@1 y 'lerp(100,220,TI)'; 2.0-3.0 [expr] crop@1 x 'lerp(150,80,TI)'; 2.0-3.0 [expr] crop@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: http://www.astro-electronic.de/FFmpeg_Book.pdf Michael
On 16 Dec 2020, at 17:25, Michael Koch <astroelectronic@t-online.de> wrote:
I think in this case it's better to use the crop filter, because it supports commands.
Thank you for your advice Michael; thanks even more for the examples to go with the advice, it is very much appreciated. I will give it a whirl. Have fun Adam
Having tried it out, this was exactly what I was looking for and makes it simple to implement. Thanks for your help Michael, you should write a book ;) Adam
On 16 Dec 2020, at 17:39, adam smith via ffmpeg-user <ffmpeg-user@ffmpeg.org> wrote:
I will give it a whirl.
On Wed, 16 Dec 2020 18:25:59 +0100 Michael Koch <astroelectronic@t-online.de> wrote:
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@1=w=800:h=800:x=0:y=0 out.mp4
You can specify the top left coordinates of the square window in the file "coord.cmd":
0.0-1.0 [expr] crop@1 x 'lerp(0,100,TI)'; 0.0-1.0 [expr] crop@1 y 'lerp(0,100,TI)'; 1.0-2.0 [expr] crop@1 x 'lerp(100,150,TI)'; 1.0-2.0 [expr] crop@1 y 'lerp(100,220,TI)'; 2.0-3.0 [expr] crop@1 x 'lerp(150,80,TI)'; 2.0-3.0 [expr] crop@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: http://www.astro-electronic.de/FFmpeg_Book.pdf
wow, the book is a great work, awesome!!!
Michael
_______________________________________________ ffmpeg-user mailing list ffmpeg-user@ffmpeg.org https://ffmpeg.org/mailman/listinfo/ffmpeg-user
To unsubscribe, visit link above, or email ffmpeg-user-request@ffmpeg.org with subject "unsubscribe".
-- Best regards, Lingjiang Fang
participants (3)
-
adam smith -
Lingjiang Fang -
Michael Koch