6 releases

0.3.2 Mar 27, 2024
0.3.1 Mar 27, 2024
0.2.0 Mar 15, 2024
0.1.1 Jan 26, 2024

#152 in Robotics

Download history 6/week @ 2024-01-23 3/week @ 2024-02-13 17/week @ 2024-02-20 9/week @ 2024-02-27 97/week @ 2024-03-12 147/week @ 2024-03-19 163/week @ 2024-03-26 54/week @ 2024-04-02

369 downloads per month

MIT license

120KB
3K SLoC

dji-log-parser

crates docs.rs

A library / cli for parsing DJI txt logs

Features

  • Supports all log versions and encryptions
  • Parse records and extract embedded images
  • Export flight tracks to GeoJSON and KML

Encryption in Version 13 and Later

Starting with version 13, log records are AES encrypted and require a specific keychain for decryption. This keychain must be obtained from DJI using their API. An apiKey is necessary to access the DJI API.

Obtaining an ApiKey

To acquire an apiKey, follow these steps:

  1. Visit DJI Developer Technologies and log in.
  2. Click CREATE APP, choose Open API as the App Type, and provide the necessary details like App Name, Category, and Description.
  3. After creating the app, activate it through the link sent to your email.
  4. On your developer user page, find your app's details to retrieve the ApiKey (labeled as the SDK key).

Cli Usage

Installation

Download binary from latest release

Basic usage

dji-log DJIFlightRecord_YYYY-MM-DD_\[00-00-00\].txt --api-key __DJI_API_KEY__ > records.json

or with an output arg

dji-log DJIFlightRecord_YYYY-MM-DD_\[00-00-00\].txt --api-key __DJI_API_KEY__ --output records.json

With image / thumbnails extraction

Use %d in the images or thumbnails option to specify a sequence.

dji-log DJIFlightRecord_YYYY-MM-DD_\[00-00-00\].txt --api-key __DJI_API_KEY__ --images image%d.jpeg --thumbnails thumbnail%d.jpeg --output records.json

With kml generation

dji-log DJIFlightRecord_YYYY-MM-DD_\[00-00-00\].txt --api-key __DJI_API_KEY__ --kml track.kml --output records.json

With geojson generation

dji-log DJIFlightRecord_YYYY-MM-DD_\[00-00-00\].txt --api-key __DJI_API_KEY__ --geojson track.json --output records.json

Library Usage

Initialization

Initialize a DJILog instance from a byte slice to access version information and metadata:

let parser = DJILog::from_bytes(&bytes).unwrap();
println!("Version: {:?}", parser.version);
println!("Info: {:?}", parser.info);

Accessing Records

Decrypt records based on the log file version. For versions prior to 13:

let records = parser.records(DecryptMethod::None);

For version 13 and later:

let records = parser.records(DecryptMethod::ApiKey("__DJI_API_KEY__"));

Advanced: Manual Keychain Retrieval

For scenarios like caching, offline use, or custom server communication, the library exposes the internal keychain retrieval process:

let keychain_request = parser.keychain_request().unwrap();
let keychains = keychain_request.fetch("__DJI_API_KEY__").unwrap();
let records = parser.records(DecryptMethod::Keychains(keychains));

Note: Replace __DJI_API_KEY__ with your actual apiKey

For more information, including a more detailed overview of the log format, visit the documentation.

License

dji-log-parser is available under the MIT license. See the LICENSE.txt file for more info.

Dependencies

~7MB
~161K SLoC