View Issue Details Jump to Notes ] Issue History ] Print ]
IDProjectCategoryView StatusDate SubmittedLast Update
0001026KdenliveEffectspublic2009-07-07 13:402013-03-31 22:19
Assigned To 
PlatformOSOS Version
Product Version 
Target VersionFixed in Version 
Summary0001026: Dynamic, keyframable clip speed
DescriptionKeyframable effect to change the clip speed. Attached an image how I would do it:

On the y Axis the frames of the input clip, on the x axis the output clip frames. This allows to draw a 2-dimensional curve over a whole clip; possible is to revert the clip speed (negative elevation), stop the clip (horizontal line), jump to an other position (vertical line), etc.

I would introduce two different kinds of nodes, one similar to the curve dialog from Gimp (see attached screenshot) which connects nodes via polynome interpolation (I assume), and a second node type which simply uses linear connections. Gimp uses freehand instead, but I don't know how useful this would be in videos.

Detailed description of the nodes:
* Left node is linear (doesn't matter). Can be moved up and down on x=0 (to let the video start at a desired position).
* A linear node draws a linear line to the previous node.
* A curve node draws an interpolated polynome curve over _all_ previous, connected curve nodes.

I first thought of using Bézier curves, but that would be no good because it would bring the problem that the curve could go in negative x direction which wouldn't make sense. Perhaps Hermite Interpolation?
* [^]
* [^]
Hermite Interpolation would allow smooth transitions whileas keeping a constant speed factor between two nodes. A local Hermite polynome is defined by two points and the slope assigned to each of these points. (See GNU Octave examples below)
  The only «problem» exists when we want to smoothly change from one constant speed factor to another one. Because the left and right node (point) both need to have the same slope factor -- e.g. the nodes a,b have slope factor s(a)=s(b)=1 and nodes c,d have s(c)=s(d)=0, so the speed between a and b will be constantly 1 and between c and d it will be 0 --, and one point cannot have two different slope values (b != c), we need to introduce another node in between. So we need to have a short transition from s(b) to s(c) between nodes b and c.
  Ah, and. Jumps in the video (slope = infinity).

* When selecting a linear node: Add a button to adjust the y position of the current node so that the elevation created by the line between the current and the previous node is 1 (means the video will be playing real-time there).
* Also: Enter a custom speed factor or frame rate to change the elevation.
* Holding Ctrl while drawing a linear node locks at steps of 90°/4 degrees (see Inkscape: Bézier tool)
* Adding an additional linear node on a linear connection: Select kind of an «add node» tool and chose the x position where it has to be added. See attachment.
TagsNo tags attached.
Build/Install MethodManual build from SVN
Attached Filespng file icon kdenlive-dynamic-clip-speed.png [^] (34,677 bytes) 2009-07-07 13:40

png file icon gimp-curves.png [^] (54,682 bytes) 2009-07-07 13:41

png file icon kdenlive-dynamic-clip-speed-add-node.png [^] (22,607 bytes) 2009-07-08 09:53

png file icon herm1b.png [^] (7,692 bytes) 2009-12-09 22:43

png file icon herm2c.png [^] (7,960 bytes) 2009-12-09 22:44

png file icon herm3b.png [^] (8,733 bytes) 2009-12-09 22:54

png file icon hermite.png [^] (8,054 bytes) 2010-01-08 17:47

txt file icon hermite.txt [^] (840 bytes) 2010-01-08 17:48 [Show Content]
txt file icon plot_hermite.txt [^] (531 bytes) 2010-01-08 17:48 [Show Content]
png file icon Kdenlive_Speed_Keyframe.png [^] (54,543 bytes) 2010-04-04 21:49

png file icon slowmoUI-gui.png [^] (23,015 bytes) 2011-05-07 12:09

- Relationships
parent of 0001124new Speed effect should be keyframe-able 
related to 0000395acknowledged Realtime Time-Stretching for Video/Audio 
related to 0000885new Allow non-linear movements for Composite effect 
Not all the children of this issue are yet resolved or closed.

-  Notes
Granjow (developer)
2009-12-09 22:43
edited on: 2009-12-09 22:55

Hermite Interpolation: Sample Octave Script, hermloceval.m:

function y = hermloceval(t, t1, t2, y1, y2, c1, c2)
% Evaluate y value at point t
% (t1, y1), (t2, y2): Left and right point
% c1, c2: Slope left and right (f'(t))

% Normize
h = t2-t1; %Distance between points
t = (t-t1)/h; %Percentage of t's position

dy = y2-y1; %y difference
oL = dy-h*c1; %Left Offset
oR = h*c2-dy-oL; %Right Offset

y = y1 + (dy + (oL + oR*t).*(t-1)).*t;

Example input 1 in Octave: (Just some points)
clf;hold on
plot([0 1 2 3], [0 1 1 3],'ko')

Example input 2: (Constant speed ratio)
clf; hold on
plot([0 1 1.1 2.1 2.2 3.2],[0 1 1.1 1.1 1.2 3.2],'ko')

Example input 3: (Smooth transition comparisation)
clf;hold on
plot(u+1,y,'r-;Ratio 1:1;')
plot(v+1,y,'g-;Ratio 4:3;')
plot(w+1,y,'k-;Ratio 5:3;')

Granjow (developer)
2010-01-08 17:50

Added: Cubic Hermite Interpolation files for Gnu Octave or Matlab. Need to be renamed from *.txt to *.m. Generates a hermite interpolation plot (hermite.png) for the given nodes/node values/slopes and the range to plot in.
evorster (reporter)
2010-04-04 21:49

Hi there...

I can't help but to think that this is a bit over-engineered...

A user needs a way to tell Kdenlive how much to speed up, and see that instantly.

May I suggest just adding a timeline to a clip, much the same way that one adds a volume line to a clip when doing keyframable volume. Difference now is that in stead of dragging your keypoints up and down to set the volume, you now drag them sideways to set the time duration of that part of the clip.

I have attached a mockup of how I imagine it would look.

-Evert Vorster-
elmo (reporter)
2011-05-06 23:52
edited on: 2011-05-06 23:52

I also vote up for this feature.
I started working on Qt widget to edit functions and what I already have can be seen here: [ [^]]

I think there should be a few ways to interpolate to choose from. As for now I have implemented linear interpolation and interpolation using third degree polynomial, but extending it with other will be a rather easy task (given the implementation of interpolation and an idea on how to make editing of this type of interpolation).

This is merely a proof of concept on how this widget can be done. As for possibility to use this widget in kdenlive I would have to know what interfaces I need to give to make it work with kdenlive. Right now I can return an object that can be used like a simple 1 dimensional math function and I don't know if this is enough or are there some specifics that I am not aware of.

Granjow (developer)
2011-05-07 12:09

Quite cool!

I've got an update on this -- I'm currently working on this feature as Bachelor Thesis, but it will be a stand-alone application at the moment. My curves canvas is not as cool as yours (only linear interpolation and moving nodes around so far, currently working on frame interpolation).

The project is in a rather early stage atm, but later I would like to integrate it into kdenlive, where we could switch to your widget.

There might also be other areas where it could be used, like for keyframeable effects … But that is not my area ;)

- Issue History
Date Modified Username Field Change
2009-07-07 13:40 Granjow New Issue
2009-07-07 13:40 Granjow Build/Install Method => Manual build from SVN
2009-07-07 13:40 Granjow File Added: kdenlive-dynamic-clip-speed.png
2009-07-07 13:41 Granjow File Added: gimp-curves.png
2009-07-07 13:41 Granjow Relationship added related to 0000395
2009-07-08 09:47 Granjow Description Updated View Revisions
2009-07-08 09:53 Granjow File Added: kdenlive-dynamic-clip-speed-add-node.png
2009-07-23 21:04 j-b-m Relationship added related to 0000885
2009-12-07 20:48 Granjow Description Updated View Revisions
2009-12-09 22:43 Granjow Note Added: 0004426
2009-12-09 22:43 Granjow File Added: herm1b.png
2009-12-09 22:44 Granjow File Added: herm2c.png
2009-12-09 22:53 Granjow Note Added: 0004427
2009-12-09 22:54 Granjow File Added: herm3b.png
2009-12-09 22:54 Granjow Note Edited: 0004426 View Revisions
2009-12-09 22:55 Granjow Note Edited: 0004426 View Revisions
2009-12-09 22:55 Granjow Note Deleted: 0004427
2009-12-09 23:08 Granjow Description Updated View Revisions
2010-01-08 17:47 Granjow File Added: hermite.png
2010-01-08 17:48 Granjow File Added: hermite.txt
2010-01-08 17:48 Granjow File Added: plot_hermite.txt
2010-01-08 17:50 Granjow Note Added: 0004501
2010-04-04 21:49 evorster Note Added: 0004919
2010-04-04 21:49 evorster File Added: Kdenlive_Speed_Keyframe.png
2011-05-06 23:52 elmo Note Added: 0006696
2011-05-06 23:52 elmo Note Edited: 0006696 View Revisions
2011-05-07 12:09 Granjow Note Added: 0006697
2011-05-07 12:09 Granjow File Added: slowmoUI-gui.png
2011-06-11 09:10 Granjow Relationship added parent of 0001124

Copyright © 2000 - 2016 MantisBT Team
Powered by Mantis Bugtracker