[FFmpeg-user] Smooth FPS change via ffmpeg
Nicolas George
george at nsup.org
Mon Sep 23 21:02:12 EEST 2019
JackDesBwa (12019-09-23):
> Speeding-up or slowing-down gradually can be useful in other situations.
This is indeed a very frequent problem. I encountered it first when
doing tone slides.
> I think it is based on the fact that you define your transformation in
> terms of framerate (frame per second) and you express it in terms of frame
> position, and the two have integral/derivative relationship.
Exactly.
> By "cheating", I would say that the integral of a linear curve is a
> parabola [ T**2 ] that you want to start at 2 at the beginning [ T**2+2 ]
> and finish at 8 at the end [ (8-2)*T**2+2 ] and stretch on 5 seconds [
> (8-2)*T**2/5**2+2 ] but then I am not sure how to apply this.
> Also, if it is the right formula, I do not understand (well I am tired now)
> how to come to this in the general case from the expression of the
> framerate curve (0.5-t*3/40)*original_framerate.
That could work, but I really would discourage from using that kind of
trial-and-error techniques because they do not scale to more complex
cases. Better go for the proper formalism, it is not very complex, a
good high-school graduate with science major can do it.
Your question is: at time t, you want to know what frame you are f(t)
(or the other way around, it does not matter much).
With constant frame rate, i.e. constant speed v, that is easy:
f(t) = v × t + f(0)
But if the speed is itself variable, v(t), then the equation is NOT:
f(t) = v(t) × t + f(0)
The relation is in fact that:
d/dt f(t) = v(t)
and it becomes:
f(t) = ∫ v(t)
So, to compute the timestamp of a frame with variable speed:
* Express your frame rate as a complete formula: t → v
* Integrate it: t → f.
* Find the reciprocal: f → t.
I cannot help more without knowing the extent of your background in
calculus.
Also, I WILL NOT help somebody who neglected to read the guidelines of
this mailing-list and follow them, including the bit about top-posting,
looking it up if necessary.
Regards,
--
Nicolas George
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 833 bytes
Desc: not available
URL: <http://ffmpeg.org/pipermail/ffmpeg-user/attachments/20190923/4eab95d6/attachment.sig>
More information about the ffmpeg-user
mailing list