Version: 1.0
- Overview
- File Format
- Header Structure
- Metadata Dictionary
- Session Section
- Frame Section
- Data Types
- Alignment Rules
- Validation Requirements
- Example Structures
e is a binary format designed for storing fixed-rate telemetry data from racing applications. The format supports multiple data channels with varying types including scalars, arrays, and structs, along with rich metadata about the data source and collection environment. The format is optimized for both streaming writes and sequential reads.
.wrtf
- Fixed rate telemetry data file
A WRTF file consists of these main sections:
- Header (fixed size)
- Metadata Dictionary
- One or more Sessions, each containing:
- Session Header
- Frame Data
- Session Footer
- Document Footer
- All multi-byte values are stored in little-endian format
- All sections and structures are aligned to 8-byte boundaries
- Padding bytes should be set to 0
Offset | Size | Type | Description |
---|---|---|---|
0 | 8 | char[8] | Magic number "WRTF0001" |
8 | 8 | uint64 | Version number (1) |
16 | 8 | uint64 | Sample rate (Hz) |
24 | 8 | uint64 | Start timestamp (microseconds since epoch) |
32 | 4 | uint32 | Number of metadata entries |
36 | 4 | uint32 | Reserved |
40 | Dynamic | Metadata | Metadata entries in the original dictionary format |
... | Variable | Padding | Ensures 8-byte alignment |
The metadata dictionary starts at offset 40
, immediately after the fixed header fields:
- Number of Metadata Entries: Already stored at offset
32
- Metadata Entries:
- Key length (K) (4 bytes): Length of UTF-8 encoded key
- Key (K bytes): UTF-8 encoded string
- Value length (V) (4 bytes): Length of UTF-8 encoded value
- Value (V bytes): UTF-8 encoded string
- Padding: Ensures 8-byte alignment
Example header with two metadata entries:
Offset | Size | Content | Description |
---|---|---|---|
0 | 8 | "WRTF0001" |
Magic number |
8 | 8 | 1 |
Version number |
16 | 8 | 48000 |
Sample rate (Hz) |
24 | 8 | 1698771650000000 |
Start timestamp |
32 | 4 | 2 |
Number of metadata entries |
36 | 4 | 0 |
Reserved |
40 | 4 | 5 |
Key length ("Track") |
44 | 5 | "Track" |
Key |
49 | 3 | 0 |
Padding |
52 | 4 | 20 |
Value length |
56 | 20 | "iracing:track/日本" |
Value |
76 | 4 | 0 |
Padding |
80 | 4 | 3 |
Key length ("Car") |
84 | 3 | "Car" |
Key |
87 | 5 | 0 |
Padding |
92 | 4 | 18 |
Value length |
96 | 18 | "iracing:car/4321" |
Value |
114 | 2 | 0 |
Padding |
Each session starts with a fixed header structure:
Offset | Size | Type | Description |
---|---|---|---|
0 | 8 | char[8] | Magic number "WRSE0001" |
8 | [S] | SessionHeader | Session header data structure (as defined in schema) |
Each session in a complete file must end with a footer structure:
Offset | Size | Type | Description |
---|---|---|---|
0 | 8 | char[8] | Magic number "WRSF0001" |
8 | 8 | uint64 | Number of frames in session |
16 | 8 | uint64 | Last frame tick |
24 | [S] | SessionFooter | Session footer data structure (as defined in schema) |
Offset | Size | Type | Description |
---|---|---|---|
0 | 8 | uint64 | Session offset from start of file |
8 | 8 | uint64 | Session footer offset from start of file |
16 | 8 | uint64 | Number of frames in session |
A complete WRTF file must end with a document footer:
Offset from EOF | Size | Type | Description |
---|---|---|---|
-(24 + N24) | 8 | char[8] | Start marker "WRDF0001" |
-(16 + N24) | N*24 | Session[] | Array of session entries |
-16 | 8 | uint64 | Number of sessions (N) |
-8 | 8 | char[8] | End marker "WRDE0001" |
To read the document footer:
- Find the end marker "WRDE0001" at the end of the file
- Read the number of sessions (N) from offset -16
- Read the session entries array
- Verify the start marker at offset -32-N*24
- The document footer provides direct access to all sessions
- Each session has a session footer with frame count and optional data
Each frame starts with an 8-byte header:
Offset | Size | Type | Description |
---|---|---|---|
0 | 8 | uint64 | Frame tick count |
The tick count increments by 1 each sample period. Frame ticks must be ordered within a session but are not required to be continuous. Gaps indicate dropped frames.
frame_time = session_timestamp + (tick_count * (1_000_000 / sample_rate))
Component | Size | Description |
---|---|---|
Frame Header | 8 | Frame tick count |
Channel Values | Varies | Sequential channel values |
Padding | Variable | Ensures 8-byte alignment |
Frame size is fixed and determined by:
- 8 bytes for frame header
- Sum of all channel sizes
- Padding to maintain 8-byte alignment
Value | Type | Size (bytes) | Description |
---|---|---|---|
0 | int8 | 1 | 8-bit signed integer |
1 | uint8 | 1 | 8-bit unsigned integer |
2 | int16 | 2 | 16-bit signed integer |
3 | uint16 | 2 | 16-bit unsigned integer |
4 | int32 | 4 | 32-bit signed integer |
5 | uint32 | 4 | 32-bit unsigned integer |
6 | int64 | 8 | 64-bit signed integer |
7 | uint64 | 8 | 64-bit unsigned integer |
8 | float32 | 4 | 32-bit IEEE 754 floating point |
9 | float64 | 8 | 64-bit IEEE 754 floating point |
10 | bool | 1 | Boolean value (0 = false, non-zero = true) |
11 | struct | varies | Composite type containing multiple fields |
12 | enum | 4 | Enumeration (uint32 backing type) |
- The header starts at file offset 0
- The metadata section starts immediately after the header
- Each metadata entry is padded to 8-byte boundary
- Session headers and footers are padded to 8-byte boundary
- Frames are padded to 8-byte boundary
- All integral types are aligned to their natural boundaries within structs
- All padding bytes should be set to 0
- Magic number must be exactly "WRTF0001"
- Version number must be 1
- Base sample rate must be > 0
- Base timestamp must be > 0
- Section offsets must be valid
- Reserved fields must be 0
- Must contain all required metadata keys
- Keys must be unique
- Keys and values must be valid UTF-8
- Keys must be not be empty strings
- Session headers must have valid magic number ("WRSE0001")
- In complete files:
- Each session must have a valid session footer with magic number ("WRSF0001")
- Session footer data must match schema definition
- Session structures must match schema definition
- Frame ticks must be ordered within each session
- Complete files must have a document footer with:
- Valid start marker "WRDF0001"
- Valid end marker "WRDE0001"
- Number of sessions must match actual number of sessions in file
- Session offsets must be valid and point to actual session headers
- Session footer offsets must be valid
See channel schema documentation for examples of common telemetry structures and channel definitions.