I'd like to apply a Zoompan effect but instead of zoom in or zoom out, I'd like to mix both of them: the zoom will start with zoom in, and, after some period of time, the zoom continue with zoom out, and so on, alternatively.

While I'm thinking how to archieve this, has someone some tips?

Thanks !


You need to use state e.g.

ffmpeg -i src.png
 -vf zoompan=d=300:z='if(gte(zoom,2)+eq(ld(1),1)*gt(zoom,1),zoom-0.04*st(1,1),zoom+0.04+0*st(1,0))'

This expression zooms from zoom=1 to zoom=2 in steps of 0.04. Remember, zoom is initialized to 1. The above will create 6 loops.

In st(store) and ld(load) functions, the first argument is variable id (0 to 9), and the second is the value.

| improve this answer | |
  • good, it works, but I don't understand very well what does it do! What if I'd like to start with zoom out and then zoom in? Thanks! – GFCoder977 Mar 27 '18 at 13:32
  • 1
    Actually, I use pzoom for z evaluazion min(pzoom+0.0015,1.5), and before zoompan I scale the image with scale=iw*10:ih*10. I'm trying to apply your formula, but it does not work. How should I change to use pzoom? – GFCoder977 Mar 28 '18 at 9:21
  • Sorry, it works well; I have updated my ffmpeg version with 3.4.2. Thanks!!! – GFCoder977 Mar 28 '18 at 11:24

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.