KLV : Key-Length-Value

Each brick of an MXF is named a KLV and is represented as follows :

MXF KLV Simple

A KLV is a data structure with three parts

KLV is the contraction of "Key, Length, Value" : it is a data structure defined in following standards :

This structure is quite simple, it is divided into three parts: it starts with a key, then the size of the data and finally with the actual data.

For example, a KLV can be represented in the following schematic form:

Key Length Value
MyKey 32 Lorem ipsum dolor sit amet odio.

As follows :

This example is extremely simplified to aid understanding. We will be come back to its true SMPTE / DCI form later.

Visually, this is what it looks like inside an MXF with several KLV :

MXF KLV Lego

As you can see, we always have a sequence of :

Key, Size, Data.
Key, Size, Data. 
Key, Size, Data. 
...etc...

Each KLV has a variable size depending on several criteria including the size of the data.

To quickly describe each part of the KLV of a specific MXF from a DCP :

Here is the raw vieuw of the beginning of an MXF file in hexadecimal form :

We just quickly saw what KLVs are : A key field, a size field and a data field. Nothing more.

If you understand this principle, you already understand half of how an MXF works :)

We will come back to each part in more depth later.

But before that, a quick explanation of the terms Universal Set and Universal Label used in SMPTE documentation, because we will use these terms regularly.

Universal Set & Universal Label : What the heck is that ?

In the SMPTE Cinematic Universe, we love the sweet little names :

Here's a simplified diagram:

MXF Universal Set & Universal Label

But why these names ?

Because there are also equivalents of the Universal Set and Universal Label but for other KLV stored in the Value part, a kind of baby KLV. These baby KLV are named Local Set and their keys Local Tag.

If we summarize the differents between the two :

KLV Baby KLV
Name of the KLV Universal Set Local Set
Name of the key Universal Label Local Tag

Don't ask me why the Local Tag wasn't named "Local Label", probably the creators were probably drunk.

But we will come back for this concept of "Baby KLV" later in the Value chapter.

Now, let's take a look at the Key part.

Notes



  1. Except for exceptions, see chapter MXF-KLV-Length 

  2. Except for exceptions, see chapter MXF-KLV-Length