Kdenlive Timeline Illustrated, Part 1

A lot of people starting to learn Kdenlive quickly get frustrated by the seemingly unintuitive and unexpected behavior of the timeline. Me too.

Probably much confusion simply arises because people expect the video tracks in Kdenlive's timeline to act like image layers – the image layers that can be found in so many graphics programs. Unfortunately, Kdenlive's tracks work quite different, but this isn't immediately obvious.

So for better insight into Kdenlive's timeline please follow me on a little journey...

This is the first blog post of a mini series of three blog posts. The topic is slightly more involved than expected and thus I divided it into multiple blog posts. In my three posts I'll illustrate how the timeline in Kdenlive really works. Some real-world examples will help understanding and may also serve as templates for particular typical tasks, such as titling and branding your project.
Update: (1) corrected the empty track illustration: Kdenlive in this situation does not allow further transition chaining. (2) also updated the corresponding text to clearly reflect this special situation and Kdenlive's handling.
Update: added the link to part 2 of this mini blog post series.

The One Rule to Remember

Even if I'm sounding like one of your teachers from childhood ... please allow for one small, yet really helpful suggestion before we begin our tour:
Please try to forget about graphics layers when working with Kdenlive. Kdenlive's tracks don't work like layers as clips can be composited in a tree-like fashion ... unlike simple layering that always is linear.
The slide layer metaphor does more wrong than good in this specific context. Alas, let's go!

Timeline: Tracks Without Layers

Okay, let's start with our little guided tour to Kdenlive's timeline. This timeline is vertically made of tracks for video and audio. In the following, I will solely focus on video tracks. The reason is that, in terms of track composition, video tracks behave differently from audio tracks and it's the compositing of video tracks that most people have problems with. Me included, that's why I also came up with these illustrations...

Kdenlive timeline illustrated ... it isn't immediately obvious ... these are tracks, not layers!

My impression is that part of the problem is Kdenlive's timeline presentation that doesn't indicate in any way that tracks are not layers. In fact, the user interface does a good job on achieving the opposite so that most users expect Kdenlive tracks to be image layers. In particular, as tracks are vertically crammed onto each other! This is the situation Kdenlive users see and which I'm showing to the left in my handmade sketch.

As we'll learn later in this series the above illustration actually shows a non-linear composition of three tracks, as the topmost track only gets composited on the result of compositing the two tracks below it. If Kdenlive would use layers then the topmost track would be composited onto the one below it first, then the result would be composited with the bottommost track. However, this example is exactly the opposite. Nasty, isn't it?

In this post and follow-ups I'm assuming that we are looking at only some particular timecode position in the timeline. For reasons of better illustrations I've often dis-aligned clips and effects time-wise. This is of no significance and just to make the illustrations less crowded.

Even worse, to further fuel confusion, Kdenlive then shows transitions as yellow bars and these bars always overlap adjacent tracks. If this doesn't massively signals that these tracks get composited, I don't know what else. Sadly, this metaphor is especially unfortunate, as we often don't want tracks to simply get composited like layered image slides. Instead, many projects demand for nonlinear compositing tracks. This is then when Kdenlive's timeline really gets unintelligible.

So ... better imagine that Kdenlive's timeline has some padding between adjacent tracks, as I've drawn it to the right in my illustration above. This imagined space allows me now to clearly show how transitions can also combine non-adjacent tracks. This is what my red arrows are good for.

Breaking the Layers

Before we get into details of composition, let's first answer the question you may have already: how do I know or how do I control in which ways Kdenlive composes tracks using transitions? The key is the so-called «with» property that every of Kdenlive's transitions has. I've marked it in the screenshot below.

The with property controls with which other track the result on the track where the transition lives is composited with. But wait a minute, as we will later see this in more details.

Hmm. So Kdenlive's tracks don't look like ordinary image layers we've come to know from so many graphics software...?! No, not really, as I've yet to come across graphics layers interconnected in crazy ways by arrows... just joking. And Synfig doesn't count...

Compositing Tracks

To better understand how Kdenlive does compositing tracks, I've drawn another illustration shown next: three tracks, each one with a clip and two transitions for compositing the tracks/clips into the final project output. In a moment you should finally clearly see why tracks are not like image layers...

Same clips, different composition.

To the left of my illustration, in variant (A) I've picked up my first example from the previous section. I'm compositing both clip 2 onto clip 3 using transition (1), as well as then clip 1 onto clip 3 using transition (2). The sequence in which the transitions are done is basically from bottom to top in this situation.

Now let's look at variant (B). In it, we're first compositing clip 1 onto clip 2 using transition (1). The result then gets composited with clip 3 by means of transition (2). The sequence in which the transitions are done now is top to bottom, the opposite of what happened in variant (A)!

At the bottom of this illustration I've also written down some kind of the steps and formula used for combining the three clips into the final result. You see: for many sets of transitions actually the order of how the two clips get combined matters. Here, both variants yield different results. You can't do this with the common image layers, at least not both.

Interestingly, some people consider the first variant (A) to be like image layering, while other consider the second variant (B) instead. Anyhow, Kdenlive's timeline allows for, well, nonlinear compositing, so comparing it to image layering is of not real use. Countless forum questions are solid proof, me thinks...

Track Compositing Detailed

So far, we've looked at how transitions combine tracks in a nonlinear fashion. But how do now clip effects fit into the overall picture? And what happens when we have a chain of transitions? So it's time for another handmade illustration, please see below.

How to calculate the compositing result for a track.

Starring at the bottom of the illustration, we find some track we want to focus on for the moment. In order to better understand how Kdenlive processes chains of transitions, I would like to introduce what I call the result (1). It's just food for your idea of Kdenlive, as you cannot really see this (intermediate) result in most cases. The only result you can really see is the final result, that is, the project output.

To arrive at this result, we first start with the clip on which the clip effects, if any, are applied (2).

Next, we slap on any transition (3), (4), ... that has its WITH property pointing to our track we're focusing on for the moment. The sequence here is always bottom to top. This is, by the way, exactly what we've seen already above as variant (A). The transitions don't need to neatly sit on directly adjacent tracks.

The only constraint Kdenlive puts here for good reason is that the transitions need to be on tracks higher up in the track list. The reason is that you could otherwise set up loops ... which won't be a good idea.

Only now comes the track's own transition into play: this allows the result to be composited with another track. As usual, this can only be a track which is further down the track list. So this is why the dashed red arrow points downwards.

Note: in Kdenlive it is impossible to apply effects to the result of a transition. Effects can only be applied to clips. Of course, transitions allow for some limited effects, but that's not the same. This is unfortunate, as in some projects this leads to severe effect bloat because the same set of effects has to be applied to several clips. And if you later need to tweak some parameters this is really getting fun to keep all in sync...

Neat Trick: Compositing WITH an Empty Track

We now come to an important and incredibly versatile trick hidden in Kdenlive's timeline ... compositing with an empty track.

The empty track trick.

As crazy as it sound, this slightly hidden feature is key to many, many slightly demanding projects. In a later blog post I will show two typical examples, namely, titling and a project branding logo.

When you look at my handmade illustration above, you'll find the track for which we want to find out the result (1) ... to be empty. No clip here. However, there are transitions on other tracks that reference this empty track. So what do we use as our starting point?

Contrary to first expectations, it's not a black clip. Instead, Kdenlive looks for the nearest clip it can find on a track higher up in the track list. In our case, the clip (2) with its effects sits on the track immediately above. In any case, Kdenlive will stop looking for a clip just before it reaches a clip which has a transition on it referencing this track. Loops, you know...

Now that we've found a suitable clip, we can proceed as before and apply those compositions (3), (4), ... that reference our track. As before, the sequence is always from bottom to top.

Important: There is one catch to watch out for though: if a track does not contain a clip (in the range we're looking at), then even if a transition is present, it will be ignored. Thus, Kdenlive does not support chaining transitions from this point on. While in most cases this is no severe limitation, in some cases it is.

Some Rule of Thumb

To sum up:

  • Simply chaining transitions gives you a compositing sequence going downwards.
  • Pointing the «WITH» property of multiple transitions to the same (result) track allows you to change the compositing sequence to going upwards instead.

Of course, you can mix both directions at the same timecode position in the timeline. Real-world examples will follow.


This ends my first blog post on Kdenlive's timeline illustrated. Please read on in my second blog post on this topic when we learn about where compositing starts and ends, and the timeline tree: Kdenlive Timeline Illustrated, Part 2.