Skip to content
DuckDB community extension

motorsport_telemetry

Query AiM MP4, Cosworth PDS, MoTeC LD, Racelogic VBOX and .telemetry recordings directly in DuckDB, with stint-aware laps

01 / SETUP

Install and load

Run these commands in a Haybarn SQL session. The extension is available from the community repository.

Haybarn 2.0.0 · SQL
INSTALL motorsport_telemetry FROM community;
LOAD motorsport_telemetry FROM community;

Using upstream DuckDB? Follow the maintainer’s installation instructions.

02 / QUERY

Usage example

SQL
SELECT name, unit, frequency_hz, sample_count
FROM telemetry_metadata('run.ld')
WHERE sample_count > 0;

SELECT *
FROM read_telemetry('run.ld',
  rate := 100,
  channels := 'Ground Speed,Throttle Pos,Brake Pedal Pos');

SELECT name, unit, frequency_hz, sample_count
FROM telemetry_metadata('run.mp4')
WHERE sample_count > 0;

SELECT *
FROM read_aim('run.mp4',
  rate := 10,
  channels := 'RPM,GPS Speed,GPS Latitude,GPS Longitude');

Provided by tobi. Not yet verified on Haybarn 2.0.0.

Sample data & setup

About this extension

motorsport_telemetry reads AiM aimd telemetry embedded in MP4, Pi Research/Cosworth PDS, MoTeC i2 LD, Racelogic VBOX VBO, and motorsport-telemetry-rs .telemetry recordings (zstd-compressed MTJ JSONL) without an export step. telemetry_laps returns each lap with a session-monotonic virtual lap number, stint index, the dash's own stint lap counter, and a normalized kind (flying, out, in, out-in, pit); telemetry_file_metadata reports flying-lap and stint counts and picks the fastest flying lap. AiM MP4 support is native-only; the DuckDB-Wasm build does not link the AiM parser, so .mp4 inputs and the read_aim/read_aimd functions are unavailable in the browser. The native reader exposes scalar CHS channels and expands each valid 56-byte GPS0 aggregate into 16 GPS channels, including WGS84 position, speed, heading, accuracy, timing, and status. It provides exact channel metadata, native-rate long-form samples, and projected wide readers with time/channel pruning and type-aware interpolation. Integer and event channels always use previous-value semantics; only floating-point channels can interpolate linearly. The parsers memory-map native files and table functions produce vectorized DuckDB output.

Project overview from the community descriptor.

Documentation and resources

Project and build details
Repository
tobi/duckdb_motorsport_telemetry
License
MIT
Maintainers
tobi
Written in
Rust
Build source
11895b4c1ffd
Build definition
Community descriptor