Mastodon

MLT Concepts

This article gives you some basic understanding about at least some MLT concepts. MLT is the media engine Kdenlive relies on for composing and rendering audio and video.

Please understand that we can’t and don’t strive to give an extensive and exhaustive introduction to MLT. Instead, we see this as a kind of layman’s intro to foster some rough first understanding of the workings of MLT in order to understand how Kdenlive makes use of MLT.

The Basic  Four Services of MLT

At MLT’s core are its four basic services (or types of services):

  • producers are sources of individual audio and video frames. As we’ll see later, there are basic (simple) producers, as well as more complex ones.
  • consumers are the sinks for audio and video frames. Examples are a screen display such as Kdenlive’s monitors, or an audio/video encoder such as AAC/H.264 that writes video container files.
  • filters (in MLT parlance) sit somewhere in between the producers and consomers. These filters modify frames as they are passing through them. In Kdenlive’s user interface, you usually see filters as effects.
  • transitions (in MLT parlance) combine two input frames into a single new output frame. See below for more details.

Producers

So producers produce frames. In the MLT framework, they produce frames only when asked to do so, because MLT adheres to pulling frames; that’s why there are tractors and consumers.

Alas, the producer services can be further divided into:

  • basic producers produce frames directly from audio/video sources; these sources may be files, devices, title clips, color clips, and other sources. See MLT basic producers for more details.
  • playlists are sequential containers for producers and optional intermediate blank spaces.
  • tractors are …
  • multitracks are …

Tractors

MLT has a somewhat unique design in that it doesn’t make use of a rendering tree. Instead, MLT uses what it terms “networks” (in quotes, see also the MLT Framework Design document). These networks connect producers to consumers, with filters (for the effects) and transitions (for mixing) in between.

An important element for pulling frames from producers on multiple (timeline) tracks and coordinating them correctly in time in order to arrive at a final frame for output is MLT’s tractor. Yes, it’s really called a “tractor”

Note: later on we will learn about playlists, which are a (sub)type of producers. The important difference between tractors and playlists is, that playlists can use multiple producers only one after another (that is, sequentially). In contrast, tractors can use producers in parallel at the same time.

Consumers

Filters

Transitions

The MLT term transition will probably confuse a lot of readers; more so, the longer they have worked with other non-linear video editors. Simply spoken, MLT’s transitions are mixers that combine exactly two input frames into a new single output frame.

Note: this is slightly simplified on purpose; more technically spoken, MLT’s transitions still outputs two frames, where the so-called “B frame” comes out unmodified, and only the “A frame” is mixed from the input A and B frames.