Decoder for MISB ST 0601 (UAS Datalink Local Set) KLV metadata, the telemetry carried in STANAG 4609 drone video streams.
- Verifies the checksum (tag 1) and rejects truncated packets.
- Scaled values in real units: degrees, meters, m/s, mbar, °C. A field whose sender reported "out of range" is
null. - Strict about malformed items. A fixed-size tag with the wrong length, a truncated pack, list or nested set, or an integer too large for a JS number is not turned into a plausible-looking wrong value: it goes to
unknownas raw bytes, along with the tags this library does not decode. - Handles BER long-form lengths, multi-byte (BER-OID) tags and IMAPB (ST 1201) values.
- Tested on real STANAG 4609 recordings (not included in the repository), and checked against the standard and jMISB.
- Zero dependencies, ESM + CJS, and runs on Node, Bun, Deno and browsers.
npm install misb0601-parserimport { decode, parseHexString } from "misb0601-parser";
const packet = parseHexString("060e2b34020b01010e01030101000000 ...")!;
const data = decode(packet); // null if the key, length or checksum is wrong
data?.precisionTimeStamp; // 1245257585099653 (µs since epoch)
data?.sensorLatitude; // 60.1768229669783
data?.sensorLongitude; // 128.426759042045
data?.platformHeadingAngle; // 159.9744The input is a Uint8Array that starts with the 16-byte ST 0601 key. Bytes after the packet are ignored, and parseKLVPacket(data)?.size tells you where the next packet starts.
| Function | Returns |
|---|---|
decode(data) |
Decoded fields, or null if the key is wrong, the packet is truncated, or the checksum is missing or invalid. |
parseKLVPacket(data) |
{ key, length, value, size }, or null. Does not check the checksum. |
parseMISB0601(value) |
Decoded fields from a local set value (the bytes after key and length). Does not check the checksum. |
parseLocalSet(value) |
Raw { [tag]: Uint8Array }, for nested sets like securityLocalSet (ST 0102) or vmtiLocalSet (ST 0903). |
verifyChecksum(packet) |
true if the packet ends with a valid tag 1 checksum. |
parseHexString(hex) |
Bytes, or null if the string isn't hex. Whitespace is allowed. |
UAS_LOCAL_SET_KEY |
The 16-byte ST 0601 Universal Label. |
Field names and types are in MISB0601Data. Tags 1 to 141 are decoded, including the IMAPB values and the packs and lists (waypoints, weapons stores, payloads, airbases, country codes, control commands, wavelengths…), with these exceptions:
- 48, 73, 74 and 95 are nested local sets (ST 0102, 0806, 0903, 1206): they are split into raw
{ [tag]: Uint8Array }for you to decode with the matching standard. - 66, 81 and 94 are returned as raw bytes, and 97–102 (more nested sets) are left in
unknown.
IMAPB special values (NaN, ±∞, below/above range) decode to null, like the ST 0601 "out of range" marker.
To get KLV out of a video file or stream, use mpegts-klv.