MLT - How to add easing to transition or filter?

437 views Asked by At

Is it possible to make some smooth movement with a picture (or anything else)? An acceleration, deceleration... I know we can use keyframe geometry to move an element but the movement is not smooth. The goal is to add some easing (ease-in / ease-out / ease-inout...) in a pictures slideshow.

This "bouncy ball" example is not really smooth: https://github.com/mltframework/mlt/blob/master/demo/mlt_bouncy_ball

My use is with the command line on a linux server, I do not use any Kdenlive or shotcut.

1

There are 1 answers

0
Dan Dennedy On

The bouncy ball example is not intended to show smoothness or easing. The examples are basic intended to get people to walk before running.

MLT Property Animation defines "smooth" keyframes. In order to make something move, you need to pick a filter such as affine that supports animated position properties. Then, how you define keyframes and their types depends on whether using the API or a property string value (command line, XML). When using the multi-value string format, you use ~= instead of = between the time and the value. For example with the affine filter: transition.rect=0~=0/0:100%x100%;100~=45%/45%:100%x100%;120~=50%/50%:100%x100%

Now, smooth keyframes alone do not provide easing, but you can add one or more keyframes towards the target (ease in) or leaving the target (ease out). The smooth keyframes simply help make the curve instead of you having to add many keyframes to smooth it out yourself. Think about drawing a curve with an illustration program. If you only have a straight line tool that connects at points, you need many points to make a smooth curve - the more points, the more smooth it will be. Now, if you have a curve tool, then you only need a few points. The Catmull-Rom spline used by MLT smooth keyframes was chosen for simplicity: It draws a curve through the points given.

As is often repeated, the easiest way to learn how to use the filters and their properties is to mock things up in a video editor and view its MLT XML output. Keep the project as simple as possible to keep the amount of XML to look through shorter.