首页 > 解决方案 > MLT - How to add easing to transition or filter?

问题描述

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.

标签: easingmlt

解决方案


弹力球示例并非旨在显示平滑度或缓动度。这些示例是基本的,旨在让人们在跑步之前先走路。

MLT属性动画定义“平滑”关键帧。为了使某些东西移动,您需要选择一个过滤器,例如支持动画位置属性的仿射。然后,如何定义关键帧及其类型取决于是使用 API 还是属性字符串值(命令行、XML)。使用多值字符串格式时,您使用时间和值之间的~=代替。=例如使用仿射过滤器: transition.rect=0~=0/0:100%x100%;100~=45%/45%:100%x100%;120~=50%/50%:100%x100%

现在,单独的平滑关键帧不能提供缓动,但您可以向目标添加一个或多个关键帧(缓入)或离开目标(缓出)。平滑的关键帧只是帮助制作曲线,而不是您必须添加许多关键帧来自己平滑它。考虑使用插图程序绘制曲线。如果你只有一个在点处连接的直线工具,你需要很多点来制作一条平滑的曲线——点越多,它就越平滑。现在,如果你有一个曲线工具,那么你只需要几个点。为简单起见,选择了 MLT 平滑关键帧使用的Catmull-Rom 样条:它通过给定的点绘制一条曲线。

正如经常重复的那样,学习如何使用过滤器及其属性的最简单方法是在视频编辑器中进行模拟并查看其 MLT XML 输出。保持项目尽可能简单,以缩短要查看的 XML 数量。


推荐阅读