Back to the blog

.ucf - Micro Container Format

April 10th, 2024

Micro Container Format (file extension .ucf) is a tiny multimedia container format. The file consists of a sequence of packets defined as follows.


Existing containers are somewhat heavyweight by being overly prescriptive and I need a very lightweight, easy to seek container for Kinetic Streamer. This specification serves as a very lightweight file format to store elementary streams. It can also be used for transmission, however it is not recommended for that use case.

Payload format

 0                   1                   2                   3
 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1
|           Track ID            |             Flags             |
|                     Presentation Timestamp                    |
|                          Data Length                          |
:                                                               :
|                             Data                              |
:                                                               :

The Track ID is a 16-bit unsigned integer that identifies the track, starting at 1. Track 0 MUST NOT be used and is reserved for metadata, such as an in-band SDP.

The Flags are a 16-bit unsigned integer that is track or implementation specific. Most commonly, the first bit is set to indicate that the packet is a keyframe, however this is not required.

The Presentation Timestamp is a 64-bit unsigned integer that is the presentation timestamp of the packet. Monotonicity of this value is OPTIONAL. The units of this value is implementation specific. A full 64 bits is reserved to accommodate nanosecond-level precision if desired. It is RECOMMENDED to use the timestamp provided by the encoder or other video source directly instead of RTP timestamps or similar derivative timestamps.

The Data Length is a 32-bit unsigned integer that is the length of the data in bytes.

The next Data Length bytes are the actual data. This data is implementation-specific, but it is RECOMMENDED to carry a single elementary stream buffer coming out of an encoder. The length of the data MUST NOT exceed the value of the Data Length field, which is maximally 2^32 - 1 bytes. If a larger payload is desired, the data MUST be split into multiple packets.


A given stream consists of a sequence of packets. When storing these files on disk, the first packet MUST be a keyframe of a given track. It is RECOMMENDED that other tracks also start with a keyframe if they cannot be instantaneously decoded.


The file format does not prescribe a particular encoding, however it is recommended to use little-endian byte order for all fields.