Answers.Body: <p>From what I understand 't' is evaluated once. Have you read this: <a href="https://ffmpeg.org/ffmpeg-filters.html#zoompan" rel="nofollow noreferrer">https://ffmpeg.org/ffmpeg-filters.html#zoompan</a> ?</p>
  
  <p>Ffmpeg Docs:</p>
  
  <p>9.170.1 Examples</p>
  
  <ul>
  <li>Zoom-in up to 1.5 and pan at same time to some spot near center of picture:</li>
  </ul>
  
  <p>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</p>
  
  <ul>
  <li>Zoom-in up to 1.5 and pan always at center of picture:</li>
  </ul>
  
  <p>zoompan=z='min(zoom+0.0015,1.5)':d=700:x='iw/2-(iw/zoom/2)':y='ih/2-(ih/zoom/2)'</p>
  
  <ul>
  <li>Same as above but without pausing:</li>
  </ul>
  
  <p>zoompan=z='min(max(zoom,pzoom)+0.0015,1.5)':d=1:x='iw/2-(iw/zoom/2)':y='ih/2-(ih/zoom/2)'</p>
  
Answers.ContentLicense: CC BY-SA 3.0
Answers.CreationDate: 2017-03-13T03:20:40.637Z
Answers.LastActivityDate: 2017-03-13T03:20:40.637Z
Answers.UserDisplayName: Rob
Body: <p>Ok, so using the overlay filter, one can change the x/y location of a video over time by using the &quot;t&quot; variable. For example, <code>overlay=x='if(gte(t,2), -w+(t-2)*20, NAN)':y=0</code> can be used to start sliding an overlayed element from the top left to top right, after 2 seconds has passed.</p>
  <p>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, <code>scale=w=iw*t</code>, or something along that line).</p>
  <p>Is this possible?</p>
  <p>when I run that expression through -filter_complex, I get</p>
  <blockquote>
  <p>Error when evaluating the expression 'iw*t'.</p>
  <p>Maybe the expression for out_w:'iw*t' or for out_h:'-1' is self-referencing.</p>
  </blockquote>
  <p>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!</p>
  <p>Does anyone know how such a task might be accomplished?</p>
  <p>Thanks for the help!</p>
  
Comments.ContentLicense: CC BY-SA 3.0
Comments.CreationDate: 2015-04-12T02:33:38.747Z
Comments.Text: Last time I was looking at ffmpeg expressions, I had a hard time finding which variables were available for expressions in which filter.  Some of them support `t`, some don't.  Re-evaluating the expression and reconfiguring the filter for each frame is expensive for some filters, so I assume that's why they don't.
Comments.UserDisplayName: Peter Cordes
Comments.ContentLicense: CC BY-SA 3.0
Comments.CreationDate: 2016-09-30T17:22:18.310Z
Comments.Text: @theophilus777, did you find the answer on your question?
Comments.UserDisplayName: Vitalii Obideiko
Comments.ContentLicense: CC BY-SA 3.0
Comments.CreationDate: 2017-02-01T05:34:38.193Z
Comments.Text: @alexspeller the scale filter does not support timeline editing, so not directly possible. I'll check if there's a workaround.
Comments.UserDisplayName: Gyan
Comments.ContentLicense: CC BY-SA 3.0
Comments.CreationDate: 2017-02-01T09:20:35.353Z
Comments.Text: @Mulvya How about extracting frames, scaling them as required and putting them back?
Comments.UserDisplayName: Macindows
Comments.ContentLicense: CC BY-SA 3.0
Comments.CreationDate: 2017-02-01T09:25:29.990Z
Comments.Text: Technically possible with H.264/5 output. Don't know how players/editors will handle it.
Comments.UserDisplayName: Gyan
Comments.ContentLicense: CC BY-SA 3.0
Comments.CreationDate: 2017-02-01T09:25:31.197Z
Comments.Text: To be honest this can be definitely accomplished by writing an external application (in python say), where the scale ratios can be multiplied by a varying factor.. I'll see what I can do.. Any suggestions are welcome.
Comments.UserDisplayName: Macindows
Comments.ContentLicense: CC BY-SA 3.0
Comments.CreationDate: 2017-02-01T09:32:52.097Z
Comments.Text: @Mulvya No, players _can't_ handle it. They need a constant frame size. Variable frames should be [_padded_  to complete the frame.](http://superuser.com/a/547406/660537)
Comments.UserDisplayName: Macindows
Comments.ContentLicense: CC BY-SA 3.0
Comments.CreationDate: 2017-02-01T09:55:02.120Z
Comments.Text: Not true. Try this: encode a video at some size but save to .TS. Encode another video with different size but same encoding settings and save as .TS. Use FFmpeg's concat demuxer or protocol to create merged MP4. Play in VLC or Potplayer. Works here. In Potplayer, if you use the kbd shortcut to resize player window size to video size, it will resize to new video parameters if you press key when the playback has switched to the 2nd video. Basically, if your encoder/muxer inserts multiple SPS/PPS in-band (i.e. in mdat) then some players do support context reinit.
Comments.UserDisplayName: Gyan
Comments.ContentLicense: CC BY-SA 3.0
Comments.CreationDate: 2017-02-02T14:33:41.790Z
Comments.Text: @alexspeller What's the purpose for the dynamic scaling?
Comments.UserDisplayName: Gyan
Comments.ContentLicense: CC BY-SA 3.0
Comments.CreationDate: 2014-07-10T19:51:37.557Z
Comments.Text: Sounds more like a syntax error right now but I haven't used that feature before so unfortunately I can't really help here.
Comments.UserDisplayName: timonsku
Comments.ContentLicense: CC BY-SA 3.0
Comments.CreationDate: 2014-07-11T21:52:29.540Z
Comments.Text: As far as I can tell, my syntax remains clean and functional until I introduce the "t" variable. Beyond that, it just seems to get mad at me and throw errors, no matter what I try :P
Comments.UserDisplayName: theophilus777
Comments.ContentLicense: CC BY-SA 3.0
Comments.CreationDate: 2014-07-12T10:57:51.173Z
Comments.Text: So everything works until you add `*t` ?
Comments.UserDisplayName: timonsku
Comments.ContentLicense: CC BY-SA 3.0
Comments.CreationDate: 2014-07-12T16:53:46.080Z
Comments.Text: *t, +t, anything having to do with "t". In any other time-adaptable features in libavfilter, you make it dynamic like that by adding a "t" to the expression. With this, introducing the "t" just causes errors, all the time. So, I'm wondering if there's a back door I'm missing, or if the feature just doesn't exist :P
Comments.UserDisplayName: theophilus777
Comments.ContentLicense: CC BY-SA 3.0
Comments.CreationDate: 2014-07-17T16:01:42.140Z
Comments.Text: t is not a defined thing when it comes to overlay filter.
Comments.UserDisplayName: v010dya
Comments.ContentLicense: CC BY-SA 3.0
Comments.CreationDate: 2014-07-18T19:32:25.747Z
Comments.Text: It is defined in regards to x and y coordinates of the overlay. You can use it effectively in those expressions (see the docs). I'm having trouble making it work on the scale values, though.
Comments.UserDisplayName: theophilus777
Comments.ContentLicense: CC BY-SA 3.0
Comments.CreationDate: 2014-08-07T12:50:55.077Z
Comments.Text: You could *just* write a filter. http://wiki.multimedia.cx/index.php?title=FFmpeg_filter_howto
Comments.UserDisplayName: denjello
Tags: <video><ffmpeg><effects><timecode><programming>
Title: Is it possible in FFMPEG to change scale over time?
UserDisplayName: theophilus777
ThreadText: # Is it possible in FFMPEG to change scale over time?
  
  (Asked by: username_0 on 2014-07-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!
  
  **Tags:** video, ffmpeg, effects, timecode, programming
  
  > **Comments:**
  > **username_5**: Sounds more like a syntax error right now but I haven't used that feature before so unfortunately I can't really help here.  
  > **username_0**: As far as I can tell, my syntax remains clean and functional until I introduce the "t" variable. Beyond that, it just seems to get mad at me and throw errors, no matter what I try :P  
  > **username_5**: So everything works until you add `*t` ?  
  > **username_0**: *t, +t, anything having to do with "t". In any other time-adaptable features in libavfilter, you make it dynamic like that by adding a "t" to the expression. With this, introducing the "t" just causes errors, all the time. So, I'm wondering if there's a back door I'm missing, or if the feature just doesn't exist :P  
  > **username_6**: t is not a defined thing when it comes to overlay filter.  
  > **username_0**: It is defined in regards to x and y coordinates of the overlay. You can use it effectively in those expressions (see the docs). I'm having trouble making it work on the scale values, though.  
  > **username_7**: You could *just* write a filter. http://wiki.multimedia.cx/index.php?title=FFmpeg_filter_howto  
  > **username_1**: Last time I was looking at ffmpeg expressions, I had a hard time finding which variables were available for expressions in which filter.  Some of them support `t`, some don't.  Re-evaluating the expression and reconfiguring the filter for each frame is expensive for some filters, so I assume that's why they don't.  
  > **username_2**: @username_0, did you find the answer on your question?  
  > **username_3**: @alexspeller the scale filter does not support timeline editing, so not directly possible. I'll check if there's a workaround.  
  > **username_4**: @Mulvya How about extracting frames, scaling them as required and putting them back?  
  > **username_3**: Technically possible with H.264/5 output. Don't know how players/editors will handle it.  
  > **username_4**: To be honest this can be definitely accomplished by writing an external application (in python say), where the scale ratios can be multiplied by a varying factor.. I'll see what I can do.. Any suggestions are welcome.  
  > **username_4**: @Mulvya No, players _can't_ handle it. They need a constant frame size. Variable frames should be [_padded_  to complete the frame.](http://superuser.com/a/547406/660537)  
  > **username_3**: Not true. Try this: encode a video at some size but save to .TS. Encode another video with different size but same encoding settings and save as .TS. Use FFmpeg's concat demuxer or protocol to create merged MP4. Play in VLC or Potplayer. Works here. In Potplayer, if you use the kbd shortcut to resize player window size to video size, it will resize to new video parameters if you press key when the playback has switched to the 2nd video. Basically, if your encoder/muxer inserts multiple SPS/PPS in-band (i.e. in mdat) then some players do support context reinit.  
  > **username_3**: @alexspeller What's the purpose for the dynamic scaling?  
  
  ---
  
  ## 1 answers
  
  ### Answer by username_8 on 2017-03-13. Score: 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)'
  
  
  ---
  
  