10

Ok, so using the overlay filter, one can change the x/y location of a video over time by using the "t" variable. For example, overlay=x='if(gte(t,2), -w+(t-2)*20, NAN)':y=0 can be used to start sliding an overlayed element from the top left to top right, after 2 seconds has passed.

What I want to do is to use a similar principle for scaling elements. I would like to be able to change the scale of a video over time by using an expression (like, scale=w=iw*t, or something along that line).

Is this possible?

when I run that expression through -filter_complex, I get

Error when evaluating the expression 'iw*t'.

Maybe the expression for out_w:'iw*t' or for out_h:'-1' is self-referencing.

I'm feeling like there's a fair chance I'm going to need to patch FFMpeg if I want to get this functionality, but I thought I would ask first, to see if anyone would be in the know about this kind of thing!

Does anyone know how such a task might be accomplished?

Thanks for the help!

16
  • Sounds more like a syntax error right now but I haven't used that feature before so unfortunately I can't really help here.
    – timonsku
    Jul 10, 2014 at 19:51
  • 1
    t is not a defined thing when it comes to overlay filter.
    – v010dya
    Jul 17, 2014 at 16:01
  • 1
    You could just write a filter. wiki.multimedia.cx/index.php?title=FFmpeg_filter_howto
    – denjello
    Aug 7, 2014 at 12:50
  • 1
    @alexspeller the scale filter does not support timeline editing, so not directly possible. I'll check if there's a workaround.
    – Gyan
    Feb 1, 2017 at 5:34
  • 1
    Technically possible with H.264/5 output. Don't know how players/editors will handle it.
    – Gyan
    Feb 1, 2017 at 9:25

1 Answer 1

2

From what I understand 't' is evaluated once. Have you read this: https://ffmpeg.org/ffmpeg-filters.html#zoompan ?

Ffmpeg Docs:

9.170.1 Examples

  • Zoom-in up to 1.5 and pan at same time to some spot near center of picture:

zoompan=z='min(zoom+0.0015,1.5)':d=700:x='if(gte(zoom,1.5),x,x+1/a)':y='if(gte(zoom,1.5),y,y+1)':s=640x360

  • Zoom-in up to 1.5 and pan always at center of picture:

zoompan=z='min(zoom+0.0015,1.5)':d=700:x='iw/2-(iw/zoom/2)':y='ih/2-(ih/zoom/2)'

  • Same as above but without pausing:

zoompan=z='min(max(zoom,pzoom)+0.0015,1.5)':d=1:x='iw/2-(iw/zoom/2)':y='ih/2-(ih/zoom/2)'

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

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