KLV
KLV (Key-Length-Value) is a data encoding standard, often used to embed information in video feeds.[src] The standard uses a type–length–value encoding scheme.[src] Items are encoded into Key-Length-Value triplets, where key identifies the data, length specifies the data's length, and value is the data itself.[src] It is defined in SMPTE 336M-2007 (Data Encoding Protocol Using Key-Length Value), approved by the Society of Motion Picture and Television Engineers.[src] Due to KLV's large degree of interoperability, it has also been adopted by the Motion Imagery Standards Board.[src]
KLV (Key-Length-Value) is a data encoding standard, often used to embed information in video feeds.[src] The standard uses a type–length–value encoding scheme.[src] Items are encoded into Key-Length-Value triplets, where key identifies the data, length specifies the data's length, and value is the data itself.[src] It is defined in SMPTE 336M-2007 (Data Encoding Protocol Using Key-Length Value), approved by the Society of Motion Picture and Television Engineers.[src] Due to KLV's large degree of interoperability, it has also been adopted by the Motion Imagery Standards Board.[src] ==Byte packing== In a binary stream of data, a KLV set is broken down in the following fashion, with all integer interpretation being big endian: ===Key field=== The first few bytes are the Key, much like a key in a standard hash table data structure.[src] Keys can be 1, 2, 4, or 16 bytes in length.[src] Presumably, in a separate specification document, you would agree on a key length for a given application.[src] Sixteen-byte keys are usually reserved for use as globally registered unique identifiers, and the Value portion of such a packet usually contains a series of more KLV sets with smaller keys.[src] ===Length field=== Following the bytes for the Key are bytes for the Length field which will tell you how many bytes follow the length field and make up the Value portion.[src] There are four kinds of encoding for the Length field: 1-byte, 2-byte, 4-byte and Basic Encoding Rules (BER).[src] The 1-, 2-, and 4-byte variants are pretty straightforward: make an unsigned integer out of the bytes, and that integer is the number of bytes that follow.[src] BER length encoding is a bit more complicated but the most flexible.[src] If the first byte in the length field does not have the high bit set (0x80), then that single byte represents an integer between 0 and 127 and indicates the number of Value bytes that immediately follow.[src] If the high bit is set, then the lower seven bits indicate how many bytes follow that themselves make up a length field.[src] For example, if the first byte of a BER length field is binary 10000010, that would indicate that the next two bytes make up an integer that then indicates how many Value bytes follow.[src] Therefore, a total of three bytes were taken up to specify a length.[src] ===Value field=== The remaining bytes are the Value field, and its contents can be whatever you like, including a chain of more KLV sets, as is often the case.[src] ===Example=== In the following example, the four bytes represent a KLV set where the key is one byte, the length field is one byte (or possibly BER - you cannot tell from the example), and the value is two bytes: a zero and a three.[src] In your application, you would have previously agreed to a) use one-byte keys and b) use one-byte length encoding.[src] Also presumably the key value "42" would mean something to you; perhaps it indicates that the value bytes 0x00 and 0x03 are an integer representing the value of your bicycle's odometer.[src] ==External links== KLVLib - A C Library for KLV file I/O Purchase The KLV Standard (SMPTE 336M-2007) ITU version of the KLV specification (ITU-R Recommendation BT.1563) (free) A Java KLV library in the Public Domain A Commercial Implementation of the Codec A Commercial Implementation of the KLV encoder/decoder lib (C++)[src]
27 sentences · 27 cited inline · 0 references stored
References
No reference rows published for this article.
Cite this article
MLA
"KLV." encyclopegia.org, 2026, https://encyclopegia.org/wiki/klv. Accessed 26 November 2026.
Chicago
"KLV." encyclopegia.org. Accessed November 26, 2026. https://encyclopegia.org/wiki/klv.
APA
encyclopegia.org. (2026). KLV. Retrieved November 26, 2026, from https://encyclopegia.org/wiki/klv
Accessed November 26, 2026 · CC BY-SA 4.0 · citation page · JSON