[FFmpeg-user] filters zoompan and crop

Jim DeLaHunt list+ffmpeg-user at jdlh.com
Fri Nov 2 00:31:40 EET 2018

On 2018-11-01 15:02, S Andreason wrote:
> Jim DeLaHunt wrote:
>> .
>>> I want to generate an overlay to zoom in, have the input png start 
>>> small, and grow to half the video size, like from 20 to 320 in 
>>> width. Starting the zoompan at z=0.1 does not seem to work.
>> Take a look at the *pad* filter 
>> <http://ffmpeg.org/ffmpeg-all.html#pad>. That generates an output 
>> frame which consists of an input frame with padding around it.
> I suppose that could work, if it would accept the frame number as a 
> variable, so that the x,y,w,h could change over time, and allow the 
> padding color to be transparent.
> So, I still see no filters to start small, without disturbing the rest 
> of the frame, and have it grow over time to full size, replacing the 
> video on the lower layer.
I see the problem. The *pad* filter doesn't let you use the frame number 
/n/ as a parameter for expressions defining /width/, /height/, /x/, and 
/y/. In contrast, the *zoompan* filter does give you both an input frame 
number and output frame number to use in expressions. I have used 
*zoompan* to animate a video by writing ridiculously complex expressions 
for /x/ and /y/ and /zoom/ based on frame number.
> You have confirmed zoompan won't shrink less than 1.0 in size factor.
> For example zoom value of 0.1 should enlarge the input stream x10 and 
> with x and y I could select where in the stream[0] to place the 
> (growing/shrinking) stream[1].

I have the impression that *zoompan* was designed with one use in mind, 
panning over a large still image, and so they missed the chance to make 
a more flexible and useful tool. I would love it if someone would make 
an "animate" filter, which could do arbitrary affine coordinate 
transforms on frames of an incoming video, based on a set of key frames, 
with bézier interpolation between the keyframes.

That tool would sure serve my needs better. Maybe it would serve yours 
also. Should we raise money for a bounty to write it?

>>> Also if the first filter was successful, I need to crop it so that 
>>> it grows over time. I am having trouble getting crop to adjust based 
>>> on the frame number. From my testing it seems n in this case starts 
>>> at 0 when the enable between starts, instead of the output video 
>>> frame number like the other filters I have been using.
>> I'm not sure I follow what you mean by "when the enable between starts".
> Sorry, I'll re-word it;
> when the "enable='between(t,#,#)'" begins
> I was experiencing something more than just 0 to 2 frames offset. I'll 
> work up another example once I have a moment to re-create it.

Thank you. That phrase is much clearer when accompanied by punctuation. 
Sorry, I've never used the /enable/ parameter, so I don't know what 
effect it has on other parameters.

Best regards,
       —Jim DeLaHunt, software engineer, Vancouver, Canada

> _______________________________________________
> ffmpeg-user mailing list
> ffmpeg-user at ffmpeg.org
> http://ffmpeg.org/mailman/listinfo/ffmpeg-user
> To unsubscribe, visit link above, or email
> ffmpeg-user-request at ffmpeg.org with subject "unsubscribe".

     --Jim DeLaHunt, jdlh at jdlh.com     http://blog.jdlh.com/ (http://jdlh.com/)
       multilingual websites consultant

       355-1027 Davie St, Vancouver BC V6E 4L2, Canada
          Canada mobile +1-604-376-8953

More information about the ffmpeg-user mailing list